Class: BiblioTech::Builders::Postgres::Import

Inherits:
Import show all
Defined in:
lib/bibliotech/builders/postgres.rb

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Import

registry_host

Methods inherited from Database

find_class

Methods inherited from Base

adapter_registry, for, #initialize, null_adapter, register, registry, supported_adapters

Constructor Details

This class inherits a constructor from BiblioTech::Builders::Base

Instance Method Details

#go(command) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/bibliotech/builders/postgres.rb', line 33

def go(command)
  command.from('pg_restore')
  command.options << '-Oc' #Don't assign ownership, clean entries
  config.optional{ command.options << "-h #{config.host}" }
  config.optional{ command.env["PGPASSWORD"] = config.password }
  config.optional{ command.options << "-p #{config.port}" } #ok

  if config.local == "development"
    config.optional{ command.options << "-U #{config.username}" }
  else
    command.options << "-U #{config.username}"
  end

  command.options << "-d #{config.database}"
  command
end