engineyard-eycap 0.3.9 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/eycap/recipes/database.rb +4 -4
- metadata +1 -1
@@ -12,8 +12,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
12
12
|
task :clone_prod_to_staging, :roles => :db, :only => { :primary => true } do
|
13
13
|
backup_name
|
14
14
|
on_rollback { run "rm -f #{backup_file}" }
|
15
|
-
|
16
|
-
if
|
15
|
+
run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
|
16
|
+
if @environment_info['adapter'] == 'mysql'
|
17
17
|
run "mysqldump --add-drop-table -u #{dbuser} -h #{production_dbhost.gsub('-master', '-replica')} -p#{dbpass} #{production_database} > #{backup_file}"
|
18
18
|
run "mysql -u #{dbuser} -p#{dbpass} -h #{staging_dbhost} #{staging_database} < #{backup_file}"
|
19
19
|
else
|
@@ -26,8 +26,8 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
26
26
|
desc "Backup your MySQL or PostgreSQL database to shared_path+/db_backups"
|
27
27
|
task :dump, :roles => :db, :only => {:primary => true} do
|
28
28
|
backup_name
|
29
|
-
|
30
|
-
if environment_info['adapter'] == 'mysql'
|
29
|
+
run("cat #{shared_path}/config/database.yml") { |channel, stream, data| @environment_info = YAML.load(data)[rails_env] }
|
30
|
+
if @environment_info['adapter'] == 'mysql'
|
31
31
|
run "mysqldump --add-drop-table -u #{dbuser} -h #{environment_dbhost.gsub('-master', '-replica')} -p#{dbpass} #{environment_database} | bzip2 -c > #{backup_file}.bz2"
|
32
32
|
else
|
33
33
|
run "PGPASSWORD=#{dbpass} pg_dump -c -U #{dbuser} -h #{environment_dbhost} #{environment_database} | bzip2 -c > #{backup_file}.bz2"
|