class MultitenancyTools::Dump::DataOnly
Public Class Methods
new(options)
click to toggle source
# File lib/multitenancy_tools/dump/data_only.rb, line 6 def initialize(options) @schema = options.fetch(:schema) @db = options.fetch(:database) @host = options.fetch(:host, nil) @user = options.fetch(:username, nil) @table = options.fetch(:table) end
Public Instance Methods
dump()
click to toggle source
# File lib/multitenancy_tools/dump/data_only.rb, line 14 def dump Open3.capture3(dump_args.shelljoin) end
Private Instance Methods
dump_args()
click to toggle source
# File lib/multitenancy_tools/dump/data_only.rb, line 20 def dump_args args = [ 'pg_dump', '--table', "#{@schema}.#{@table}", '--no-privileges', '--no-tablespaces', '--no-owner', '--dbname', @db, '--data-only', '--inserts' ] args << ['--host', @host] if @host.present? args << ['--username', @user] if @user.present? args.flatten end