thoughtbot / parity

Shell commands for development, staging, and production parity for Heroku apps
https://thoughtbot.com
MIT License
889 stars 57 forks source link

foreign key constraint violations and relation does not exist errors when restoring from production #202

Closed toomanyjoes closed 1 year ago

toomanyjoes commented 1 year ago

Help us track down and resolve parity problems faster with this template.

What command did you execute?

staging restore-from production

What did you expect to happen?

Cleanly restore production backup to staging environment

What actually happened?

foreign key constraint violations and relation does not exist errors

I don't think triggers and tables are being created in the right order, a trigger is created referencing a table that doesn't yet exist and a foreign key constraint is created on a table with data before the corresponding data exists in the foreign key table.

I realize this isn't necessarily a parity problem but does parity have some arguments that may be able to correct this?

Does parity have some kind of --clean option to just completely delete the target db before restoring?