Class: Nandi::MigrationModifiers::CreateTableValidatesFks
- Defined in:
- lib/nandi/migration_modifiers/create_table_validates_fks.rb
Class Method Summary collapse
Methods inherited from Base
Class Method Details
.up(instructions) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/nandi/migration_modifiers/create_table_validates_fks.rb', line 6 def self.up(instructions) new_tables = instructions. select { |i| i.procedure == :create_table }. to_set { |i| i.table.to_sym } return if new_tables.empty? instructions. grep(Instructions::AddForeignKey). select { |i| new_tables.include?(i.table.to_sym) }. each(&:validate!) end |