Class: Cequel::Schema::TableDiffer

Inherits:
Object
  • Object
show all
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.

Since:

  • 1.0.0

Instance Method Summary collapse

Instance Method Details

#callObject

Returns a Patch that will transform table_a in to table_b.

Since:

  • 1.0.0



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