Class: ActiveRecord::Snapshot::MySQL
- Inherits:
-
Object
- Object
- ActiveRecord::Snapshot::MySQL
- Defined in:
- lib/active_record/snapshot/commands/mysql.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.dump(*args) ⇒ Object
4 5 6 |
# File 'lib/active_record/snapshot/commands/mysql.rb', line 4 def self.dump(*args) new.dump(*args) end |
.import(*args) ⇒ Object
13 14 15 |
# File 'lib/active_record/snapshot/commands/mysql.rb', line 13 def self.import(*args) new.import(*args) end |
Instance Method Details
#dump(tables:, output:) ⇒ Object
8 9 10 11 |
# File 'lib/active_record/snapshot/commands/mysql.rb', line 8 def dump(tables:, output:) dump_command("--no-data #{database} > #{output}") && dump_command("--quick #{database} #{tables.join(" ")} >> #{output}") end |
#import(input:) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/active_record/snapshot/commands/mysql.rb', line 17 def import(input:) system(" nice mysql \\\\\n --user \#{username} \\\\\n \#{password ? '--password' : ''} \#{password} \\\\\n --host \#{host} \\\\\n \#{database} < \#{input}\n SH\nend\n") |