0

I have two postgres databases.

Master = master_database Slave = database

All initial changes are made to master. Upon admin approval, the version is updated, and I want all changes to be copied to slave. I looked into using octupos, rubyrep, etc. but I don't want an automatic replication.

I'd like to add a rake task that is executed only when the version is updated.

I've tried using pg_dump and pg_restore, but I get error messages saying that:

ERROR: relation "whatever" already exists ~ OR ~ ERROR: multiple primary keys for table "whatevers" are not allowed

  • You could use pg_restore with --clean, but it'll drop all the tables before re-creating them so you'll want to be sure there's no important data there. – Craig Ringer Jul 4 '14 at 0:46
  • @CraigRinger Thanks! This was exactly what I needed. I'm replicating the entire database, so I have no concern for losing data. – user2168130 Jul 7 '14 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.