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



144
145
146
# File 'lib/zdm.rb', line 144

def initialize(table)
  @table = table
end

Instance Attribute Details

#tableObject (readonly)

Returns the value of attribute table.



142
143
144
# File 'lib/zdm.rb', line 142

def table
  @table
end

Instance Method Details

#cleanupObject



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