Class: DB2Fog::MysqlAdaptor
- Inherits:
-
Object
- Object
- DB2Fog::MysqlAdaptor
- Defined in:
- lib/db2fog.rb
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(credentials) ⇒ MysqlAdaptor
constructor
A new instance of MysqlAdaptor.
- #restore(path) ⇒ Object
Constructor Details
#initialize(credentials) ⇒ MysqlAdaptor
Returns a new instance of MysqlAdaptor.
83 84 85 |
# File 'lib/db2fog.rb', line 83 def initialize(credentials) @credentials = credentials end |
Instance Method Details
#dump ⇒ Object
87 88 89 90 91 92 93 94 95 |
# File 'lib/db2fog.rb', line 87 def dump dump_file = Tempfile.new("dump") cmd = "mysqldump --quick --single-transaction --create-options #{}" cmd += " | gzip -9 > #{dump_file.path}" run(cmd) dump_file.path end |
#restore(path) ⇒ Object
97 98 99 |
# File 'lib/db2fog.rb', line 97 def restore(path) run "gunzip -c #{path} | mysql #{}" end |