Class: DbDiff::Delta::AddColumn
- Inherits:
-
DbDiff::Delta
- Object
- DbDiff::Delta
- DbDiff::Delta::AddColumn
- Defined in:
- lib/dbdiff/delta.rb
Instance Attribute Summary
Attributes inherited from DbDiff::Delta
Instance Method Summary collapse
-
#initialize(element) ⇒ AddColumn
constructor
A new instance of AddColumn.
- #process(database) ⇒ Object
- #sql ⇒ Object
Methods inherited from DbDiff::Delta
Constructor Details
#initialize(element) ⇒ AddColumn
Returns a new instance of AddColumn.
57 58 59 60 |
# File 'lib/dbdiff/delta.rb', line 57 def initialize(element) super @element.auto_increment = false end |
Instance Method Details
#process(database) ⇒ Object
66 67 68 69 |
# File 'lib/dbdiff/delta.rb', line 66 def process(database) table = table(database) table.columns << element end |
#sql ⇒ Object
62 63 64 |
# File 'lib/dbdiff/delta.rb', line 62 def sql "ALTER TABLE #{element.table_name} ADD COLUMN " + element.definition(true) end |