Class: K8sflow::Pg::Copy
- Defined in:
- lib/k8sflow/command/pg/copy.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
.call ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/k8sflow/command/pg/copy.rb', line 15 def self.call source_db = database([:source]) puts "env PGSSLMODE=#{ssl?} PGPASSWORD=#{source_db[:password]} pg_dump --host #{source_db[:host]} --port #{source_db[:port]} --username #{source_db[:user]} --verbose -Z 0 --clean --format=c --no-owner --no-acl -d #{source_db[:database]} | env PGSSLMODE=#{ssl?} PGPASSWORD=#{database[:password]} pg_restore --port #{database[:port]}--host #{database[:host]} --username #{database[:user]} --verbose --no-acl --no-owner -d #{database[:database]}" confirm_command("on #{database[:host]} overwrite the database #{database[:database]}") exec("env PGSSLMODE=#{ssl?} PGPASSWORD=#{source_db[:password]} pg_dump --host #{source_db[:host]} --port #{source_db[:port]} --username #{source_db[:user]} --verbose -Z 0 --clean --format=c --no-owner --no-acl -d #{source_db[:database]} | env PGSSLMODE=#{ssl?} PGPASSWORD=#{database[:password]} pg_restore --port #{database[:port]} --host #{database[:host]} --username #{database[:user]} --verbose --no-acl --no-owner -d #{database[:database]}") end |