Class: Lotus::Model::Migrator::PostgresAdapter Private
- Defined in:
- lib/lotus/model/migrator/postgres_adapter.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
PostgreSQL adapter
Constant Summary collapse
- HOST =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'PGHOST'.freeze
- PORT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'PGPORT'.freeze
- USER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'PGUSER'.freeze
- PASSWORD =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'PGPASSWORD'.freeze
Constants inherited from Adapter
Adapter::MIGRATIONS_TABLE, Adapter::MIGRATIONS_TABLE_VERSION_COLUMN
Instance Method Summary collapse
- #create ⇒ Object private
- #drop ⇒ Object private
- #dump ⇒ Object private
- #load ⇒ Object private
Methods inherited from Adapter
Constructor Details
This class inherits a constructor from Lotus::Model::Migrator::Adapter
Instance Method Details
#create ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 |
# File 'lib/lotus/model/migrator/postgres_adapter.rb', line 27 def create set_environment_variables `createdb #{ database }` end |
#drop ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/lotus/model/migrator/postgres_adapter.rb', line 34 def drop set_environment_variables require 'open3' Open3.popen3('dropdb', database) do |stdin, stdout, stderr, wait_thr| exit_status = wait_thr.value unless exit_status.success? = stderr.read = if .match(/does not exist/) "Cannot find database: #{ database }" else end raise MigrationError.new() end end end |
#dump ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
58 59 60 61 62 |
# File 'lib/lotus/model/migrator/postgres_adapter.rb', line 58 def dump set_environment_variables dump_structure dump_migrations_data end |
#load ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
66 67 68 69 |
# File 'lib/lotus/model/migrator/postgres_adapter.rb', line 66 def load set_environment_variables load_structure end |