Class: K8sflow::Pg::Restore

Inherits:
PgBase
  • Object
show all
Defined in:
lib/k8sflow/command/pg/restore.rb

Class Method Summary collapse

Methods inherited from PgBase

database, databases, exec_sql, hash_opt, kv_parse, nine_two?, parse_pg_uri, pid_column, psql_cmd, query_column, ssl?, version

Class Method Details

.callObject



15
16
17
18
19
20
# File 'lib/k8sflow/command/pg/restore.rb', line 15

def self.call
  file = options[:src]
  puts "PGSSLMODE=#{ssl?} PGPASSWORD=#{database[:password]} pg_restore --port #{database[:port]} --host #{database[:host]} --username #{database[:user]}  --verbose --no-acl --no-owner -d #{database[:database]} #{file}"
  confirm_command("on #{database[:host]} overwrite the database #{database[:database]}")
  exec("PGSSLMODE=#{ssl?} PGPASSWORD=#{database[:password]} pg_restore --port #{database[:port]} --host #{database[:host]} --username #{database[:user]}  --verbose --no-acl --no-owner -d #{database[:database]} #{file}")
end