lib/eycap/recipes/database.rb in engineyard-eycap-0.4.5 vs lib/eycap/recipes/database.rb in engineyard-eycap-0.4.6

- old
+ new

@@ -23,17 +23,17 @@ dbhost = @environment_info['host'] dbhost = environment_dbhost.sub('-master', '') + '-replica' if dbhost != 'localhost' # added for Solo offering, which uses localhost run "mysqldump --add-drop-table -u #{dbuser} -h #{dbhost} -p #{environment_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out | ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/ end - run "mysql -u #{dbuser} -p -h #{staging_dbhost} #{staging_database} < #{backup_file}" do |ch, stream, out| + run "bzcat #{backup_file}.bz2 | mysql -u #{dbuser} -p -h #{staging_dbhost} #{staging_database}" do |ch, stream, out| ch.send_data "#{dbpass}\n" if out=~ /^Enter password:/ end else - run "pg_dump -W -c -U #{dbuser} -h #{production_dbhost} -f #{backup_file} #{production_database}" do |ch, stream, out| + run "pg_dump -W -c -U #{dbuser} -h #{production_dbhost} #{production_database} | bzip2 -c > #{backup_file}.bz2" do |ch, stream, out| ch.send_data "#{dbpass}\n" if out=~ /^Password:/ end - run "psql -W -U #{dbuser} -h #{staging_dbhost} -f #{backup_file} #{staging_database}" do |ch, stream, out| + run "bzcat #{backup_file}.bz2 | psql -W -U #{dbuser} -h #{staging_dbhost} #{staging_database}" do |ch, stream, out| ch.send_data "#{dbpass}\n" if out=~ /^Password:/ end end run "rm -f #{backup_file}" end