From 8fe10e642ad9b5d236d2b00cea475bdc519130c0 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Wed, 26 Feb 2014 18:26:31 +0100 Subject: [PATCH] Empty the database during Postgres backup restore --- lib/backup/database.rb | 2 ++ 1 file changed, 2 insertions(+), 0 deletions(-) diff --git a/lib/backup/database.rb b/lib/backup/database.rb index ebb4f28..6552f45 100644 --- a/lib/backup/database.rb +++ b/lib/backup/database.rb @@ -29,6 +29,8 @@ module Backup print "Restoring MySQL database #{config['database']} ... " system('mysql', *mysql_args, config['database'], in: db_file_name) when "postgresql" then + puts "Destructively rebuilding database schema for RAILS_ENV #{Rails.env}" + Rake::Task["db:schema:load"].invoke print "Restoring PostgreSQL database #{config['database']} ... " pg_env system('psql', config['database'], '-f', db_file_name) -- libgit2 0.21.2