Class: DbDiff::Delta::ModifyTable

Inherits:
DbDiff::Delta show all
Defined in:
lib/dbdiff/delta.rb

Instance Attribute Summary

Attributes inherited from DbDiff::Delta

#element

Instance Method Summary collapse

Methods inherited from DbDiff::Delta

#initialize, #table, #to_a

Constructor Details

This class inherits a constructor from DbDiff::Delta

Instance Method Details

#process(database) ⇒ Object



246
247
248
249
250
251
# File 'lib/dbdiff/delta.rb', line 246

def process(database)
  cur_table = database.tables.find{|t| t.name == element.name}
  # need full copy of meta-data, but can't swap out the deltas or columns
  cur_table.engine = element.engine.dup
  cur_table.collation = element.collation.dup
end

#sqlObject



242
243
244
# File 'lib/dbdiff/delta.rb', line 242

def sql
  "ALTER TABLE #{element.name} ENGINE=%s DEFAULT CHARSET=%s" % [element.engine, element.charset] 
end