Methods

Class/Module Index [+]

Quicksearch

Backup::Database::MySQL

Attributes

additional_options[RW]

Additional "mysqldump" options

host[RW]

Connectivity options

mysqldump_utility[RW]

Path to mysqldump utility (optional)

name[RW]

Name of the database that needs to get dumped To dump all databases, set this to `:all` or leave blank.

only_tables[RW]

Tables to dump, tables that aren't specified won't get dumped

password[RW]

Credentials for the specified database

port[RW]

Connectivity options

skip_tables[RW]

Tables to skip while dumping the database

socket[RW]

Connectivity options

username[RW]

Credentials for the specified database

Public Class Methods

new(model, &block) click to toggle source

Creates a new instance of the MySQL adapter object

# File lib/backup/database/mysql.rb, line 41
def initialize(model, &block)
  super(model)

  @skip_tables        ||= Array.new
  @only_tables        ||= Array.new
  @additional_options ||= Array.new

  instance_eval(&block) if block_given?

  @name ||= :all
  @mysqldump_utility ||= utility(:mysqldump)
end

Public Instance Methods

perform!() click to toggle source

Performs the mysqldump command and outputs the data to the specified path based on the 'trigger'

# File lib/backup/database/mysql.rb, line 57
def perform!
  super

  pipeline = Pipeline.new
  dump_ext = 'sql'

  pipeline << mysqldump
  if @model.compressor
    @model.compressor.compress_with do |command, ext|
      pipeline << command
      dump_ext << ext
    end
  end
  pipeline << "cat > '#{ File.join(@dump_path, dump_filename) }.#{ dump_ext }'"

  pipeline.run
  if pipeline.success?
    Logger.message "#{ database_name } Complete!"
  else
    raise Errors::Database::PipelineError,
        "#{ database_name } Dump Failed!\n" +
        pipeline.error_messages
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.