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.
125 126 127 |
# File 'lib/db2fog.rb', line 125 def initialize(credentials) @credentials = credentials end |
Instance Method Details
#dump ⇒ Object
129 130 131 132 133 134 135 136 137 |
# File 'lib/db2fog.rb', line 129 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
139 140 141 |
# File 'lib/db2fog.rb', line 139 def restore(path) run "gunzip -c #{path} | psql #{}" end |