Class: Zdm::Migrator

Inherits:
Object
  • Object
show all
Defined in:
lib/zdm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table) ⇒ Migrator

Returns a new instance of Migrator.



172
173
174
# File 'lib/zdm.rb', line 172

def initialize(table)
  @table = table
end

Instance Attribute Details

#tableObject (readonly)

Returns the value of attribute table.



170
171
172
# File 'lib/zdm.rb', line 170

def table
  @table
end

Instance Method Details

#cleanupObject



191
192
193
194
# File 'lib/zdm.rb', line 191

def cleanup
  drop_triggers
  execute('DROP TABLE IF EXISTS `%s`' % table.copy)
end

#migrate!Object



176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/zdm.rb', line 176

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