lib/ridgepole/diff.rb in ridgepole-0.8.2 vs lib/ridgepole/diff.rb in ridgepole-0.8.3
- old
+ new
@@ -45,9 +45,17 @@
from.each do |table_name, from_attrs|
next unless target?(table_name)
delta[:delete] ||= {}
delta[:delete][table_name] = from_attrs
+
+ foreign_keys = from_attrs.fetch(:foreign_keys, {})
+ next if foreign_keys.empty?
+
+ table_delta = {}
+ scan_foreign_keys_change(foreign_keys, {}, table_delta, @options)
+ delta[:change] ||= {}
+ delta[:change][table_name] = table_delta
end
end
delta[:execute] = options[:execute]