Commit c674a9de
Changed files (3)
.gitignore
@@ -11,3 +11,4 @@ NERD_tree_*
tags
.sass-cache/
*.fuse*
+latest
capfile
@@ -26,6 +26,8 @@ task :backup_db do
end
task :restore_db do
- upload("db/backups/latest", "db/backups/latest", :via => :scp)
- run "psql -U postgress -d #{destination_db} -f #{dumpfile}"
+ dumpfile = "~/db/backups/latest"
+ destination_db = "cakeside_production"
+ upload("latest", "db/backups/latest", :via => :scp)
+ run "psql -U cakeside -d #{destination_db} -f #{dumpfile}"
end
Rakefile
@@ -42,10 +42,10 @@ end
task :restore do
# 1. backup prod database
- #sh "cap production backup_db"
+ sh "cap production backup_db"
# 2. copy backup to staging
- sh "ln -s db/backups/`ls -rt db/backups/ | tail -n1` latest"
+ sh "rm -f latest && ln -s db/backups/`ls -rt db/backups/ | tail -n1` latest"
# 3. restore backup on staging
- #sh "cap staging restore_db"
+ sh "cap staging restore_db"
end