Class: Lotus::Model::Migrator::PostgresAdapter Private

Inherits:
Adapter
  • Object
show all
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

Since:

  • 0.4.0

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.

Since:

  • 0.4.0

'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.

Since:

  • 0.4.0

'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.

Since:

  • 0.4.0

'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.

Since:

  • 0.4.0

'PGPASSWORD'.freeze

Constants inherited from Adapter

Adapter::MIGRATIONS_TABLE, Adapter::MIGRATIONS_TABLE_VERSION_COLUMN

Instance Method Summary collapse

Methods inherited from Adapter

for, #initialize, #version

Constructor Details

This class inherits a constructor from Lotus::Model::Migrator::Adapter

Instance Method Details

#createObject

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.

Since:

  • 0.4.0



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/lotus/model/migrator/postgres_adapter.rb', line 27

def create
  set_environment_variables

  call_db_command('createdb') do |error_message|
    message = if error_message.match(/already exists/)
      "createdb: database creation failed. There is 1 other session using the database."
    else
      error_message
    end

    raise MigrationError.new(message)
  end
end

#dropObject

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.

Since:

  • 0.4.0



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/lotus/model/migrator/postgres_adapter.rb', line 43

def drop
  set_environment_variables

  call_db_command('dropdb') do |error_message|
    message = if error_message.match(/does not exist/)
      "Cannot find database: #{ database }"
    else
      error_message
    end

    raise MigrationError.new(message)
  end
end

#dumpObject

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.

Since:

  • 0.4.0



59
60
61
62
63
# File 'lib/lotus/model/migrator/postgres_adapter.rb', line 59

def dump
  set_environment_variables
  dump_structure
  dump_migrations_data
end

#loadObject

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.

Since:

  • 0.4.0



67
68
69
70
# File 'lib/lotus/model/migrator/postgres_adapter.rb', line 67

def load
  set_environment_variables
  load_structure
end