Class: DB2Fog::PsqlAdaptor
- Inherits:
-
Object
- Object
- DB2Fog::PsqlAdaptor
- Defined in:
- lib/db2fog.rb
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(credentials) ⇒ PsqlAdaptor
constructor
A new instance of PsqlAdaptor.
- #restore(path) ⇒ Object
Constructor Details
#initialize(credentials) ⇒ PsqlAdaptor
Returns a new instance of PsqlAdaptor.
121 122 123 |
# File 'lib/db2fog.rb', line 121 def initialize(credentials) @credentials = credentials end |
Instance Method Details
#dump ⇒ Object
125 126 127 128 129 130 131 132 133 |
# File 'lib/db2fog.rb', line 125 def dump dump_file = Tempfile.new("dump") cmd = "pg_dump --clean --format=p #{}" cmd += " | gzip -9 > #{dump_file.path}" run(cmd) dump_file.path end |
#restore(path) ⇒ Object
135 136 137 |
# File 'lib/db2fog.rb', line 135 def restore(path) run "gunzip -c #{path} | psql #{}" end |