feat:
--Instruction.txt UUID instructions added
--main.py
--'default',
'default_insert_only',
'ddl_sql'
This commit is contained in:
1 parent
ce55d6f591
commit
0e7c62c285
2 files changed
+70
-2
No files matched your search
@@ -285,3 +285,66 @@ postgres=#
|
||||
|
||||
!!!!!!!!!WHEN TESTING NEW NODES OR REFRESHING THE NODES!!!!!!!!!
|
||||
SET spock.enable_ddl_replication = off;
|
||||
|
||||
|
||||
|=============================|
|
||||
|ADD UUID IN AN EXISTING TABLE|
|
||||
|=============================|
|
||||
|
||||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
ALTER TABLE public.test_replication
|
||||
ADD COLUMN uuid_id uuid DEFAULT gen_random_uuid();
|
||||
Populate any existing rows that somehow got NULL:
|
||||
UPDATE public.test_replication
|
||||
SET uuid_id = gen_random_uuid()
|
||||
WHERE uuid_id IS NULL;
|
||||
Make it not null:
|
||||
ALTER TABLE public.test_replication
|
||||
ALTER COLUMN uuid_id SET NOT NULL;
|
||||
Now remove the old primary key:
|
||||
ALTER TABLE public.test_replication
|
||||
DROP CONSTRAINT test_replication_pkey;
|
||||
Make the UUID the new primary key:
|
||||
ALTER TABLE public.test_replication
|
||||
ADD PRIMARY KEY (uuid_id);
|
||||
|
||||
|===========================|
|
||||
|!!!CAUTION AFTER LINKING!!!|
|
||||
|===========================|
|
||||
CHECK THIS
|
||||
SELECT * FROM spock.replication_set_table;
|
||||
|
||||
SELECT
|
||||
slot_name,
|
||||
active,
|
||||
active_pid,
|
||||
restart_lsn,
|
||||
confirmed_flush_lsn
|
||||
FROM pg_replication_slots;
|
||||
|
||||
postgres=# SELECT *
|
||||
FROM spock.replication_set;
|
||||
|
||||
|===============================|
|
||||
|CREATE A TABLE NOT USING SPROKE|
|
||||
|===============================|
|
||||
SELECT spock.replicate_ddl(
|
||||
$$
|
||||
CREATE TABLE public.vm2_ddl_test (
|
||||
uuid_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
source_node TEXT NOT NULL,
|
||||
message TEXT,
|
||||
created_at TIMESTAMPTZ DEFAULT now()
|
||||
);
|
||||
$$
|
||||
);
|
||||
|
||||
WTF IS THIS!!!
|
||||
To check if provider is sending data
|
||||
postgres=# SELECT
|
||||
slot_name,
|
||||
active,
|
||||
active_pid,
|
||||
restart_lsn,
|
||||
confirmed_flush_lsn
|
||||
FROM pg_replication_slots;
|
||||
@@ -190,8 +190,13 @@ def link_nodes(data: LinkNodeRequest):
|
||||
SELECT spock.sub_create(
|
||||
subscription_name := %s,
|
||||
provider_dsn := %s,
|
||||
synchronize_structure := true,
|
||||
synchronize_data := true
|
||||
replication_sets := ARRAY[
|
||||
'default',
|
||||
'default_insert_only',
|
||||
'ddl_sql'
|
||||
],
|
||||
synchronize_structure := false, # CHANGE THIS TO TRUE IF YOU WANT TO SYNCHRONIZE DATA
|
||||
synchronize_data := false
|
||||
);
|
||||
""", (
|
||||
data.subscription_name,
|
||||
|
||||
Reference in new issue
Block a user