Class: Snapshooter::Datastore::Mysql

Inherits:
Object
  • Object
show all
Defined in:
lib/snapshooter/datastore/mysql.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Mysql

Returns a new instance of Mysql.



6
7
8
# File 'lib/snapshooter/datastore/mysql.rb', line 6

def initialize(options={})
  @options = options
end

Instance Method Details

#filenameObject



18
19
20
# File 'lib/snapshooter/datastore/mysql.rb', line 18

def filename
  "#{id}.sql"
end

#restore(file) ⇒ Object



14
15
16
# File 'lib/snapshooter/datastore/mysql.rb', line 14

def restore(file)
  `mysql #{mysql_options} #{@options[:database]} < #{file}`
end

#snapshot(tmp_file) ⇒ Object



10
11
12
# File 'lib/snapshooter/datastore/mysql.rb', line 10

def snapshot(tmp_file)
  `mysqldump #{mysqldump_options} #{@options[:database]} > #{tmp_file}`
end