Class: Cequel::Schema::TableDiffer
- Inherits:
-
Object
- Object
- Cequel::Schema::TableDiffer
- Defined in:
- lib/cequel/schema/table_differ.rb
Overview
Utility object that calculates a ‘Patch` to transform one `Table` into another.
Currently this support adding columns, adding and removing indexes, and setting properties on the table. Any other changes are prohibited due to CQL limitation or data integrity concerns. A ‘InvalidSchemaMigration` will be raised if unsupported changes are detected.
Instance Method Summary collapse
-
#call ⇒ Object
Returns a Patch that will transform table_a in to table_b.
Instance Method Details
#call ⇒ Object
Returns a Patch that will transform table_a in to table_b.
21 22 23 24 25 26 27 28 29 |
# File 'lib/cequel/schema/table_differ.rb', line 21 def call (fail InvalidSchemaMigration, "Table renames are not supported") if table_a.name != table_b.name (fail InvalidSchemaMigration, "Changes to key structure is not allowed") if keys_changed? (fail InvalidSchemaMigration, "Type changes are not allowed") if any_types_changed? Patch.new(figure_changes) end |