Sha256: effeba5aa4ad3b79bdab58cd2463c7dbb1cd1f9fa446a7ba321546ff08161b62

Contents?: true

Size: 537 Bytes

Versions: 9

Compression:

Stored size: 537 Bytes

Contents

module ActiveRecord::MysqlBackup
  def purge
    config = instance_variable_get("@config").easy_access

    recreate_database(config.database)  
  end
  
  def sqldump(file)
    config = instance_variable_get("@config").easy_access
    
    cmd_opts = ""
    cmd_opts << "-h #{config.host} " if config.host?
    cmd_opts << "-u #{config.username} " if config.username?
    cmd_opts += "-p#{config.password} " if config.password?

    cmd = "mysqldump #{cmd_opts} #{config.database} > #{file}"
    STDERR.puts cmd
    `#{cmd}`
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vex-0.3.3 lib/vex/active_record/mysql_backup.rb
vex-0.2.9 lib/vex/active_record/mysql_backup.rb
vex-0.2.8 lib/vex/active_record/mysql_backup.rb
vex-0.2.7 lib/vex/active_record/mysql_backup.rb
vex-0.2.6 lib/vex/active_record/mysql_backup.rb
vex-0.2.5 lib/vex/active_record/mysql_backup.rb
vex-0.2.2 lib/vex/active_record/mysql_backup.rb
vex-0.2.1 lib/vex/active_record/mysql_backup.rb
vex-0.2 lib/vex/active_record/mysql_backup.rb