Sha256: 169e5014e2363bbe9dfe79d40e922358973d87d4506b4f1dd8339372cea5f503
Contents?: true
Size: 856 Bytes
Versions: 12
Compression:
Stored size: 856 Bytes
Contents
namespace :mail_engine do desc "Check mail schedule table and send the scheduled mail." task :export_mail_engine_database => :environment do datetime = Time.now.strftime("%Y%m%d") db_config = YAML.load_file(File.join(Rails.root, 'config', 'database.yml'))[Rails.env] db_username = db_config["username"] db_password = db_config["password"] db_database = db_config["database"] db_socket = db_config["socket"] tables = ['mail_templates', 'mail_schedules', "mail_template_files", "template_partials"] backup_file_path = File.join(Rails.root,"tmp", "mail_engine_backup", "#{db_database}_#{datetime}.sql") system "mkdir -p #{File.join(Rails.root,"tmp", "mail_engine_backup")}" system "mysqldump -u #{db_username} -S #{db_socket} -p'#{db_password}' #{db_database} #{tables.join(' ')}> #{backup_file_path}" end end
Version data entries
12 entries across 12 versions & 1 rubygems