Class: Zdm::Migrator
- Inherits:
-
Object
- Object
- Zdm::Migrator
- Defined in:
- lib/zdm.rb
Instance Attribute Summary collapse
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(table) ⇒ Migrator
constructor
A new instance of Migrator.
- #migrate! ⇒ Object
Constructor Details
#initialize(table) ⇒ Migrator
144 145 146 |
# File 'lib/zdm.rb', line 144 def initialize(table) @table = table end |
Instance Attribute Details
#table ⇒ Object (readonly)
Returns the value of attribute table.
142 143 144 |
# File 'lib/zdm.rb', line 142 def table @table end |
Instance Method Details
#cleanup ⇒ Object
163 164 165 166 |
# File 'lib/zdm.rb', line 163 def cleanup drop_triggers execute('DROP TABLE IF EXISTS `%s`' % table.copy) end |
#migrate! ⇒ Object
148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/zdm.rb', line 148 def migrate! validate set_session_lock_wait_timeouts cleanup create_copy_table # drop_copy_indexes apply_ddl_statements create_triggers copy_in_batches # create_copy_indexes atomic_switcharoo! ensure cleanup end |