Class: Avm::Stereotypes::Postgresql::Instance
- Inherits:
-
Object
- Object
- Avm::Stereotypes::Postgresql::Instance
- Defined in:
- lib/avm/stereotypes/postgresql/instance.rb,
lib/avm/stereotypes/postgresql/instance/data_unit.rb
Defined Under Namespace
Classes: DataUnit
Instance Method Summary collapse
- #data_unit ⇒ Object
- #dump_command ⇒ Object
- #dump_gzip_command ⇒ Object
-
#initialize(env, connection_params) ⇒ Instance
constructor
A new instance of Instance.
- #psql_command ⇒ Object
- #psql_command_command(sql) ⇒ Object
Constructor Details
#initialize(env, connection_params) ⇒ Instance
Returns a new instance of Instance.
9 10 11 12 |
# File 'lib/avm/stereotypes/postgresql/instance.rb', line 9 def initialize(env, connection_params) @env = env @connection_params = connection_params.with_indifferent_access end |
Instance Method Details
#data_unit ⇒ Object
14 15 16 |
# File 'lib/avm/stereotypes/postgresql/instance.rb', line 14 def data_unit ::Avm::Stereotypes::Postgresql::Instance::DataUnit.new(self) end |
#dump_command ⇒ Object
18 19 20 21 |
# File 'lib/avm/stereotypes/postgresql/instance.rb', line 18 def dump_command env.command('pg_dump', '--no-privileges', '--clean', '--no-owner', *common_command_args) .envvar('PGPASSWORD', password) end |
#dump_gzip_command ⇒ Object
23 24 25 |
# File 'lib/avm/stereotypes/postgresql/instance.rb', line 23 def dump_gzip_command dump_command.append(['@ESC_|', 'gzip', '-9', '-c']) end |
#psql_command ⇒ Object
27 28 29 |
# File 'lib/avm/stereotypes/postgresql/instance.rb', line 27 def psql_command env.command("@ESC_PGPASSWORD=#{password}", 'psql', *common_command_args) end |
#psql_command_command(sql) ⇒ Object
31 32 33 |
# File 'lib/avm/stereotypes/postgresql/instance.rb', line 31 def psql_command_command(sql) psql_command.append(['--quiet', '--tuples-only', '--command', sql]) end |