mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added publication and subscription support in Schema Diff. Fixes #6153
This commit is contained in:
committed by
Akshay Joshi
parent
c1e80ac38a
commit
44cc7a308a
@@ -1117,3 +1117,44 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping;
|
||||
|
||||
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
|
||||
OPTIONS (password 'admin123');
|
||||
|
||||
-- Publication Script
|
||||
CREATE TABLE test_schema_diff.table_for_publication (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE PUBLICATION for_all_table
|
||||
FOR ALL TABLES
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
CREATE PUBLICATION with_one_table
|
||||
FOR TABLE test_schema_diff.table_for_publication
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
ALTER PUBLICATION with_one_table
|
||||
RENAME TO with_one_table_alter;
|
||||
|
||||
ALTER PUBLICATION with_one_table_alter SET
|
||||
(publish = 'insert, update');
|
||||
|
||||
-- Subscription script
|
||||
|
||||
CREATE SUBSCRIPTION "subscription_test1"
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
|
||||
PUBLICATION sample_publication
|
||||
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
SET (synchronous_commit = 'remote_apply');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
SET PUBLICATION edb WITH (refresh = false);
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
RENAME TO subscription_test;
|
||||
|
||||
DROP SUBSCRIPTION subscription_test;
|
||||
|
||||
@@ -1062,3 +1062,50 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping
|
||||
OPTIONS (password 'admin123');
|
||||
|
||||
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping;
|
||||
|
||||
-- Publication script
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication_in_target (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE PUBLICATION for_all_table
|
||||
FOR ALL TABLES
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
CREATE PUBLICATION with_one_table_in_target
|
||||
FOR TABLE test_schema_diff.table_for_publication_in_target
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target
|
||||
RENAME TO with_one_table_in_target_alter;
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target_alter SET
|
||||
(publish = 'insert, update');
|
||||
|
||||
-- Subscription script
|
||||
|
||||
CREATE SUBSCRIPTION "subscription_test1_in_target"
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
|
||||
PUBLICATION sample_publication
|
||||
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
SET (synchronous_commit = 'remote_apply');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
SET PUBLICATION edb WITH (refresh = false);
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
RENAME TO subscription_test_in_target;
|
||||
|
||||
DROP SUBSCRIPTION subscription_test_in_target;
|
||||
|
||||
@@ -1116,3 +1116,46 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping;
|
||||
|
||||
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
|
||||
OPTIONS (password 'admin123');
|
||||
|
||||
-- Publication Script
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE PUBLICATION for_all_table
|
||||
FOR ALL TABLES
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
CREATE PUBLICATION with_one_table
|
||||
FOR TABLE test_schema_diff.table_for_publication
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
ALTER PUBLICATION with_one_table
|
||||
RENAME TO with_one_table_alter;
|
||||
|
||||
ALTER PUBLICATION with_one_table_alter SET
|
||||
(publish = 'insert, update, truncate');
|
||||
|
||||
-- Subscription script
|
||||
|
||||
CREATE SUBSCRIPTION "subscription_test1"
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
|
||||
PUBLICATION sample_publication
|
||||
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
SET (synchronous_commit = 'remote_apply');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
SET PUBLICATION edb WITH (refresh = false);
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
RENAME TO subscription_test;
|
||||
|
||||
DROP SUBSCRIPTION subscription_test;
|
||||
|
||||
|
||||
@@ -1061,3 +1061,51 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping
|
||||
OPTIONS (password 'admin123');
|
||||
|
||||
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping;
|
||||
|
||||
-- Publication scripts
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication_in_target (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE PUBLICATION for_all_table
|
||||
FOR ALL TABLES
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
CREATE PUBLICATION with_one_table_in_target
|
||||
FOR TABLE test_schema_diff.table_for_publication_in_target
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target
|
||||
RENAME TO with_one_table_in_target_alter;
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target_alter SET
|
||||
(publish = 'insert, update, truncate');
|
||||
|
||||
-- Subscription script
|
||||
|
||||
CREATE SUBSCRIPTION "subscription_test1_in_target"
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
|
||||
PUBLICATION sample_publication
|
||||
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
SET (synchronous_commit = 'remote_apply');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
SET PUBLICATION edb WITH (refresh = false);
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
RENAME TO subscription_test_in_target;
|
||||
|
||||
DROP SUBSCRIPTION subscription_test_in_target;
|
||||
|
||||
|
||||
@@ -1117,3 +1117,53 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping;
|
||||
|
||||
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping
|
||||
OPTIONS (password 'admin123');
|
||||
|
||||
-- Publication scripts
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication_in_target (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE PUBLICATION for_all_table
|
||||
FOR ALL TABLES
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
CREATE PUBLICATION with_one_table_in_target
|
||||
FOR TABLE test_schema_diff.table_for_publication_in_target
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target
|
||||
OWNER TO managers;
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target
|
||||
RENAME TO with_one_table_in_target_alter;
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target_alter SET
|
||||
(publish = 'insert, update, truncate');
|
||||
|
||||
-- Subscription script
|
||||
|
||||
CREATE SUBSCRIPTION "subscription_test1"
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
|
||||
PUBLICATION sample_publication
|
||||
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
SET (synchronous_commit = 'remote_apply');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
SET PUBLICATION edb WITH (refresh = false);
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
RENAME TO subscription_test;
|
||||
|
||||
DROP SUBSCRIPTION subscription_test;
|
||||
|
||||
@@ -1050,3 +1050,51 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping
|
||||
OPTIONS (password 'admin123');
|
||||
|
||||
CREATE USER MAPPING FOR postgres SERVER test_fs_for_user_mapping;
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication_in_target (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE PUBLICATION for_all_table
|
||||
FOR ALL TABLES
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
CREATE PUBLICATION with_one_table_in_target
|
||||
FOR TABLE test_schema_diff.table_for_publication_in_target
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target
|
||||
OWNER TO managers;
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target
|
||||
RENAME TO with_one_table_in_target_alter;
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target_alter SET
|
||||
(publish = 'insert, update, truncate');
|
||||
|
||||
-- Subscription script
|
||||
|
||||
CREATE SUBSCRIPTION "subscription_test1_in_target"
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
|
||||
PUBLICATION sample_publication
|
||||
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
SET (synchronous_commit = 'remote_apply');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
SET PUBLICATION edb WITH (refresh = false);
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
RENAME TO subscription_test_in_target;
|
||||
|
||||
DROP SUBSCRIPTION subscription_test_in_target;
|
||||
|
||||
@@ -1275,3 +1275,46 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping;
|
||||
|
||||
CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping
|
||||
OPTIONS (password 'admin123');
|
||||
|
||||
-- Publication Script
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
|
||||
CREATE PUBLICATION for_all_table
|
||||
FOR ALL TABLES
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
CREATE PUBLICATION with_one_table
|
||||
FOR TABLE test_schema_diff.table_for_publication
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
ALTER PUBLICATION with_one_table
|
||||
RENAME TO with_one_table_alter;
|
||||
|
||||
ALTER PUBLICATION with_one_table_alter SET
|
||||
(publish = 'insert, update');
|
||||
|
||||
-- Subscription script
|
||||
|
||||
CREATE SUBSCRIPTION "subscription_test1"
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
|
||||
PUBLICATION sample_publication
|
||||
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
SET (synchronous_commit = 'remote_apply');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
SET PUBLICATION edb WITH (refresh = false);
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1
|
||||
RENAME TO subscription_test;
|
||||
|
||||
DROP SUBSCRIPTION subscription_test;
|
||||
|
||||
@@ -1212,3 +1212,50 @@ CREATE USER MAPPING FOR public SERVER test_fs_for_user_mapping
|
||||
OPTIONS (password 'admin123');
|
||||
|
||||
CREATE USER MAPPING FOR enterprisedb SERVER test_fs_for_user_mapping;
|
||||
|
||||
-- Publication script
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE TABLE test_schema_diff.table_for_publication_in_target (
|
||||
col1 integer NOT NULL,
|
||||
col2 text
|
||||
);
|
||||
|
||||
CREATE PUBLICATION for_all_table
|
||||
FOR ALL TABLES
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
CREATE PUBLICATION with_one_table_in_target
|
||||
FOR TABLE test_schema_diff.table_for_publication_in_target
|
||||
WITH (publish = 'insert, delete');
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target
|
||||
RENAME TO with_one_table_in_target_alter;
|
||||
|
||||
ALTER PUBLICATION with_one_table_in_target_alter SET
|
||||
(publish = 'insert, update');
|
||||
|
||||
-- Subscription script
|
||||
|
||||
CREATE SUBSCRIPTION "subscription_test1_in_target"
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=edb password=samplepassword'
|
||||
PUBLICATION sample_publication
|
||||
WITH (connect = false, enabled = false, create_slot = false, slot_name = None, synchronous_commit = 'off');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
CONNECTION 'host=localhost port=5432 user=postgres dbname=postgres';
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
SET (synchronous_commit = 'remote_apply');
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
SET PUBLICATION edb WITH (refresh = false);
|
||||
|
||||
ALTER SUBSCRIPTION subscription_test1_in_target
|
||||
RENAME TO subscription_test_in_target;
|
||||
|
||||
DROP SUBSCRIPTION subscription_test_in_target;
|
||||
|
||||
1319
web/pgadmin/tools/schema_diff/tests/ppas/11_plus/source.sql
Normal file
1319
web/pgadmin/tools/schema_diff/tests/ppas/11_plus/source.sql
Normal file
File diff suppressed because it is too large
Load Diff
1261
web/pgadmin/tools/schema_diff/tests/ppas/11_plus/target.sql
Normal file
1261
web/pgadmin/tools/schema_diff/tests/ppas/11_plus/target.sql
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user