summaryrefslogtreecommitdiff
path: root/lib/tasks/database.rake
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tasks/database.rake')
-rw-r--r--lib/tasks/database.rake3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/tasks/database.rake b/lib/tasks/database.rake
index 5194d268..1e2e3e1e 100644
--- a/lib/tasks/database.rake
+++ b/lib/tasks/database.rake
@@ -2,9 +2,10 @@ namespace :db do
task :restore do
config = Rails.configuration.database_configuration
destination_db = config[Rails.env]["database"]
+ host = config[Rails.env]["host"]
newest_backup = Dir['db/backups/*.dump'].max_by { |file| File.mtime(file) }
- sh "PGPASSWORD=#{config[Rails.env]["password"]} pg_restore --verbose --clean --no-acl --no-owner -h localhost -U #{config[Rails.env]["username"]} -d #{destination_db} #{newest_backup}"
+ sh "PGPASSWORD=#{config[Rails.env]["password"]} pg_restore --verbose --clean --no-acl --no-owner -h #{host} -U #{config[Rails.env]["username"]} -d #{destination_db} #{newest_backup}"
end
task :backup do