Class: Hanami::Model::Migrator::MySQLAdapter Private
- Defined in:
- lib/hanami/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
Constant Summary collapse
- 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.
"MYSQL_PWD"
- DEFAULT_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.
3306
- DB_CREATION_ERROR =
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.
"Database creation failed. If the database exists, " \ "then its console may be open. See this issue for more details: " \ "https://github.com/hanami/model/issues/250"
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
for, #initialize, #migrate, #rollback, #version
Constructor Details
This class inherits a constructor from Hanami::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 31 32 33 34 35 36 37 |
# File 'lib/hanami/model/migrator/mysql_adapter.rb', line 27 def create new_connection(global: true).run %(CREATE DATABASE `#{database}`;) rescue Sequel::DatabaseError => exception = if exception..match(/database exists/) DB_CREATION_ERROR else exception. end raise MigrationError.new() 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.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/hanami/model/migrator/mysql_adapter.rb', line 41 def drop new_connection(global: true).run %(DROP DATABASE `#{database}`;) rescue Sequel::DatabaseError => exception = if exception..match(/doesn\'t exist/) "Cannot find database: #{database}" else exception. end raise MigrationError.new() 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.
55 56 57 58 |
# File 'lib/hanami/model/migrator/mysql_adapter.rb', line 55 def dump 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.
62 63 64 |
# File 'lib/hanami/model/migrator/mysql_adapter.rb', line 62 def load load_structure end |