Class: MysqlAdapter
- Inherits:
-
Object
- Object
- MysqlAdapter
- Includes:
- System
- Defined in:
- lib/db_adapters/mysql_adapter.rb
Instance Method Summary collapse
- #backup_extension ⇒ Object
-
#db_dump ⇒ Object
Creates and runs mysqldump and throws into .tar.gz file.
-
#initialize(db_credentials) ⇒ MysqlAdapter
constructor
A new instance of MysqlAdapter.
- #load_db_dump(dump_file) ⇒ Object
Methods included from System
clean, db_credentials, hostname, prompt, run, tarzip_folders, unzip_file
Constructor Details
#initialize(db_credentials) ⇒ MysqlAdapter
Returns a new instance of MysqlAdapter.
5 6 7 |
# File 'lib/db_adapters/mysql_adapter.rb', line 5 def initialize(db_credentials) @db_credentials = db_credentials end |
Instance Method Details
#backup_extension ⇒ Object
26 27 28 |
# File 'lib/db_adapters/mysql_adapter.rb', line 26 def backup_extension return ".sql" end |
#db_dump ⇒ Object
Creates and runs mysqldump and throws into .tar.gz file. Returns .tar.gz file
11 12 13 14 15 16 17 |
# File 'lib/db_adapters/mysql_adapter.rb', line 11 def db_dump dump_file = Tempfile.new("dump") cmd = "mysqldump --quick --single-transaction --create-options #{}" cmd += " > #{dump_file.path}" System.run(cmd) return dump_file end |