lib/ridgepole/diff.rb in ridgepole-0.6.5.beta12 vs lib/ridgepole/diff.rb in ridgepole-0.6.5.beta13
- old
+ new
@@ -113,14 +113,14 @@
scan_column_rename(from, to, definition_delta)
# for reverse option
scan_column_rename(to, from, definition_delta)
- if table_options[:primary_key].nil?
- priv_column_name = (table_options[:id] == false) ? nil : 'id'
+ if table_options[:id] == false or table_options[:primary_key].is_a?(Array)
+ priv_column_name = nil
else
- priv_column_name = table_options[:primary_key]
+ priv_column_name = table_options[:primary_key] || 'id'
end
to.each do |column_name, to_attrs|
if (from_attrs = from.delete(column_name))
normalize_column_options!(from_attrs)
@@ -305,10 +305,10 @@
def columns_all_include?(expected_columns, actual_columns, table_options)
unless expected_columns.is_a?(Array)
return true
end
- if table_options[:id] != false
+ if table_options[:id] != false and not table_options[:primary_key].is_a?(Array)
actual_columns = actual_columns + [(table_options[:primary_key] || 'id').to_s]
end
expected_columns.all? {|i| actual_columns.include?(i) }
end