Commit ddd26e48
Changed files (1)
lib
tasks
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