Last active
October 3, 2019 13:46
-
-
Save ramses-lopez/ea804ecfee6bea0e9091fa71ba625fc4 to your computer and use it in GitHub Desktop.
Dump & restore cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Backup comfy tables & static_contents table | |
pg_dump -Fc --clean --if-exists --no-owner -t 'comfy_*' -t static_contents omx_staging > comfy_backup_20180723.sql | |
# Well.. | |
dropdb omx_staging && createdb omx_staging | |
# Restore production data | |
pg_restore --no-owner -d omx_staging July232018-08_53_11.backup | |
# Restore comfy tables | |
pg_restore --clean --no-owner --verbose -d omx_staging comfy_backup_20180723.sql | |
# migrate, and we're done. | |
RAILS_ENV=staging2 bundle exec rake db:migrate | |
# Restore postgres | |
dropdb omx_development && createdb omx_development && pg_restore --clean --no-owner --verbose -d omx_development ~/Downloads/March042019-10_33_48.backup | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment