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
Returns a new instance of Migrator.
176 177 178 |
# File 'lib/zdm.rb', line 176 def initialize(table) @table = table end |
Instance Attribute Details
#table ⇒ Object (readonly)
Returns the value of attribute table.
174 175 176 |
# File 'lib/zdm.rb', line 174 def table @table end |
Instance Method Details
#cleanup ⇒ Object
195 196 197 198 |
# File 'lib/zdm.rb', line 195 def cleanup drop_triggers execute('DROP TABLE IF EXISTS `%s`' % table.copy) end |
#migrate! ⇒ Object
180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/zdm.rb', line 180 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 |