DEV Community

Discussion on: Postgresql on local and remote: how do you sync?

Collapse
 
rhymes profile image
rhymes

I think dump and restore is your best bet if you don't want to setup replication.

I would keep them separate in the end, because your production database (the online version) and its backups should be the "single source of truth" and your local copy probably contains all the experiments and maybe data that's not 100% clean. They might also have slightly different versions of PostgreSQL (not an issue unless it's a major version)

So if you need to keep them in sync decide who's the master and who's the replica and do the dump and restores in one direction unless you're sure you can rebuild the data at any time with seeding scripts.

Once the app is finished, stop restoring the production db from the local db and setup automatic backups :-)

Collapse
 
danroc profile image
Daniel da Rocha

Cool! This sounds so obvious and so much simpler... I was getting worried about all the setup I was gonna have to do :O

Thanks!!