Method: OceanDynamo::Tables::ClassMethods#update_table_if_required

Defined in:
lib/ocean-dynamo/tables.rb

#update_table_if_requiredObject



120
121
122
123
124
125
126
127
128
129
130
# File 'lib/ocean-dynamo/tables.rb', line 120

def update_table_if_required
  attrs = table_attribute_definitions
  active_attrs = []
  dynamo_table.attribute_definitions.each do |k| 
    active_attrs << { attribute_name: k.attribute_name, attribute_type: k.attribute_type }
  end
  return false if active_attrs == attrs
  options = { attribute_definitions: attrs }
  dynamo_table.update(options)
  true
end