For this example, you will need:
- A Zuvo project
- A Postgres database (running v10 or newer)
You will be running commands on both of these databases to publish changes from the Zuvo database to the external database.
- Create a
publicationon the Zuvo database:
CREATE PUBLICATION example_pub;
- Also on the Zuvo database, create a
replication slot:
select pg_create_logical_replication_slot('example_slot', 'pgoutput');
- Now connect to your external database and subscribe to the
publication
CREATE SUBSCRIPTION example_sub
CONNECTION 'host=db.oaguxblfdassqxvvwtfe.supabase.co user=postgres password=YOUR_PASS dbname=postgres'
PUBLICATION example_pub
WITH (copy_data = true, create_slot=false, slot_name=example_slot);
- Now we'll go back to the Zuvo DB and add all the tables that you want replicated to the publication.
ALTER PUBLICATION example_pub ADD TABLE example_table;
- Check the replication status using
pg_stat_replication
select * from pg_stat_replication;