Module: FIDIUS::Common::Db
- Defined in:
- lib/fidius-common/yamldb.rb
Overview
Provides methods for the export/import of database dumps to/from YAML.
Class Method Summary collapse
-
.export(config_filename, db_entry, target_dir = "", timestamp = true) ⇒ Object
Exports database schema and content to yml file.
-
.import(config_filename, db_entry, import_dir) ⇒ Object
Imports the content of a previously exported yml file.
Class Method Details
.export(config_filename, db_entry, target_dir = "", timestamp = true) ⇒ Object
Exports database schema and content to yml file. This should work for all ActiveRecord database adapters.
16 17 18 19 |
# File 'lib/fidius-common/yamldb.rb', line 16 def self.export(config_filename, db_entry, target_dir = "", = true) dumper = SerializationHelper::Base.new(YamlDb::Helper, config_filename, db_entry) dumper.dump(target_dir, ) end |
.import(config_filename, db_entry, import_dir) ⇒ Object
Imports the content of a previously exported yml file.
26 27 28 29 |
# File 'lib/fidius-common/yamldb.rb', line 26 def self.import(config_filename, db_entry, import_dir) loader = SerializationHelper::Base.new(YamlDb::Helper, config_filename, db_entry) loader.load(import_dir) end |