Class: Apartment::Adapters::Mysql2SchemaAdapter
- Inherits:
-
AbstractAdapter
- Object
- AbstractAdapter
- Apartment::Adapters::Mysql2SchemaAdapter
- Defined in:
- lib/apartment/adapters/mysql2_adapter.rb
Overview
Mysql2 Schemas Adapter
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from AbstractAdapter
Instance Method Summary collapse
-
#initialize(config) ⇒ Mysql2SchemaAdapter
constructor
A new instance of Mysql2SchemaAdapter.
-
#reset ⇒ Object
Reset current tenant to the default_tenant.
Methods inherited from AbstractAdapter
#create, #current, #drop, #each, #environmentify, #init, #process_excluded_models, #seed_data, #switch, #switch!
Constructor Details
#initialize(config) ⇒ Mysql2SchemaAdapter
Returns a new instance of Mysql2SchemaAdapter.
35 36 37 38 39 40 |
# File 'lib/apartment/adapters/mysql2_adapter.rb', line 35 def initialize(config) super @default_tenant = config[:database] reset end |
Instance Method Details
#reset ⇒ Object
Reset current tenant to the default_tenant
44 45 46 47 48 |
# File 'lib/apartment/adapters/mysql2_adapter.rb', line 44 def reset return unless default_tenant Apartment.connection.execute "use `#{default_tenant}`" end |