• G
    Let t.foreign_key use the same `to_table` twice · aedde2a3
    George Millo 提交于
    Previously if you used `t.foreign_key` twice within the same
    `create_table` block using the same `to_table`, all statements except
    the final one would fail silently. For example, the following code:
    
        def change
          create_table :flights do |t|
            t.integer :from_id, index: true, null: false
            t.integer :to_id,   index: true, null: false
    
            t.foreign_key :airports, column: :from_id
            t.foreign_key :airports, column: :to_id
          end
        end
    
    Would only create one foreign key, on the column `from_id`.
    
    This commit allows multiple foreign keys to the same table to be created
    within one `create_table` block.
    aedde2a3
references_foreign_key_test.rb 6.6 KB