Class: Dbcp::PostgresDatabase

Inherits:
Database
  • Object
show all
Defined in:
lib/dbcp/databases/postgres_database.rb

Instance Method Summary collapse

Methods inherited from Database

build, klass_for_adapter

Instance Method Details

#export_command(snapshot_file) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/dbcp/databases/postgres_database.rb', line 3

def export_command(snapshot_file)
  build_password + [
    'pg_dump',
    '--host',     host,
    build_port,
    '--username', username,
    '--file',     snapshot_file.path,
    '--format',   'c',
    database
  ].flatten.compact.shelljoin
end

#import_command(snapshot_file) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dbcp/databases/postgres_database.rb', line 15

def import_command(snapshot_file)
  build_password + [
    'pg_restore',
    '--host',     host,
    build_port,
    '--username', username,
    '--dbname',   database,
    '--clean',
    snapshot_file.path
  ].flatten.compact.shelljoin
end