Class: Lotus::Model::Migrator::MySQLAdapter Private

Inherits:
Adapter
  • Object
show all
Defined in:
lib/lotus/model/migrator/mysql_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.

MySQL adapter

Since:

  • 0.4.0

Constant Summary

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



11
12
13
# File 'lib/lotus/model/migrator/mysql_adapter.rb', line 11

def create
  new_connection(global: true).run %(CREATE DATABASE #{ database };)
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



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/lotus/model/migrator/mysql_adapter.rb', line 17

def drop
  new_connection(global: true).run %(DROP DATABASE #{ database };)
rescue Sequel::DatabaseError => e
  message = if e.message.match(/doesn\'t exist/)
    "Cannot find database: #{ database }"
  else
    e.message
  end

  raise MigrationError.new(message)
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



31
32
33
34
# File 'lib/lotus/model/migrator/mysql_adapter.rb', line 31

def dump
  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



38
39
40
# File 'lib/lotus/model/migrator/mysql_adapter.rb', line 38

def load
  load_structure
end