lib/capistrano/tasks/z10_remote_db_diff.rb
# Performs the actual operations required for a DB dump update given the specified
# parameters but only LOCALLY, in the context of Capistrano.
#
# Note that the dump takes the name of the Environment configuration section.
#
Performs the actual operations required for a DB dump update given the specified
parameters but only LOCALLY, in the context of Capistrano.

Note that the dump takes the name of the Environment configuration section.
Performs the actual operations required for a DB dump update given the specified parameters but only LOCALLY in the context of Capistrano . Note that the dump takes the name of the Environment configuration section .
def local_db_dump( db_dump_dir, db_host, db_user, db_pwd, db_name, dump_basename )
    puts "\r\nUpdating recovery dump '#{ dump_basename }' (from #{db_name} DB)..."
    zip_pipe = ' | bzip2 -c'
    file_ext = '.sql.bz2'                           
    puts "DB name: #{ db_name }"
    puts "DB user: #{ db_user }"
    file_name = File.join( db_dump_dir, "#{ dump_basename }#{ file_ext }" )
    puts "\r\nProcessing #{ db_name } => #{ file_name } ...\r\n"
    run_locally do
      execute :mysqldump, "--host=#{ db_host } -u #{ db_user } --password=\"#{db_pwd}\" -l --triggers --routines -i --skip-extended-insert --no-autocommit --single-transaction #{ db_name } #{ zip_pipe } > #{ file_name }"
    end
    puts "\r\nRecovery dump created.\r\n\r\n"
  end
def local_db_dump ( db_dump_dir , db_host , db_user , db_pwd , db_name , dump_basename ) puts "\r\nUpdating recovery dump '#{ dump_basename }' (from #{db_name} DB)..." zip_pipe = ' | bzip2 -c' file_ext = '.sql.bz2' puts "DB name: #{ db_name }" puts "DB user: #{ db_user }" file_name = File . join ( db_dump_dir , "#{ dump_basename }#{ file_ext }" ) puts "\r\nProcessing #{ db_name } => #{ file_name } ...\r\n" run_locally do execute :mysqldump , "--host=#{ db_host } -u #{ db_user } --password=\"#{db_pwd}\" -l --triggers --routines -i --skip-extended-insert --no-autocommit --single-transaction #{ db_name } #{ zip_pipe } > #{ file_name }" end puts "\r\nRecovery dump created.\r\n\r\n" end
Performs the actual operations required for a DB dump update given the specified
parameters but only LOCALLY, in the context of Capistrano.
Performs the actual operations required for a DB dump update given the specified parameters but only LOCALLY in the context of Capistrano .
# Display some info: # To disable extended inserts, add this option: --skip-extended-insert # (The Resulting SQL file will be much longer, though -- but the bzipped #  version can result more compressed due to the replicated strings, and it is #  indeed much more readable and editable...)
db_dump_dir
<not_specific>
db_host
<not_specific>
db_user
<not_specific>
db_pwd
<not_specific>
db_name
<not_specific>
dump_basename
<not_specific>