Can Ankane/PGSYNC (https://github.com/ankane/pgsync) be used to only add data and not remove data from destination?

19 views Asked by At

I have a use case where I need to unidirectional sync between Postgres Databases so that all records of source which are not present in Destination are copied over but records present in Destination and not present in source are not removed from Destination.

I am able to implement sync using Ankane/pgsync where it makes my destination table same as source tables.

Take same tables in Destination and Source

Initial State

Source Table A:

Destination Table A:

Row 1 Row 2

First change in source

Now we add one row to Source Table A.

Source Table A:

Row 5

After running pgsync, Destination table should like

Destination Table A:

Row 1 Row 2 Row 5

Second change in source

We remove the Row 5 entry from source Table A

Source Table A:

After running pgsync, Destination table should like

Destination Table A:

Row 1 Row 2 Row 5

**Third change in source ** we add another row to Source Table A.

Source Table A:

Row 6

After running pgsync, Destination table should like

Destination Table A:

Row 1 Row 2 Row 5 Row 6

0

There are 0 answers