Class: CucumberTree::Handler::Database::Postgresql
- Defined in:
- lib/cucumber_tree/handlers/databases/postgresql.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#load(snapshot) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/cucumber_tree/handlers/databases/postgresql.rb', line 7 def load(snapshot) dump_file = snapshot[:postgres_file] = [] << "-U #{db_config['username']}" if db_config['username'].present? << "-d #{db_config['database']}" << "-f #{dump_file}" `psql #{.join(' ')}` end |
#save(snapshot) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cucumber_tree/handlers/databases/postgresql.rb', line 16 def save(snapshot) dump_file = ::CucumberTree::TempDir.file_name("postgres.dump") = [] << "-f #{dump_file}" << "-U #{db_config['username']}" if db_config['username'].present? << "--exclude-table=schema_migrations" << "-a #{db_config['database']}" `pg_dump #{.join(' ')}` snapshot[:postgres_file] = dump_file end |