class CreateMatches < ActiveRecord::Migration[5.0]
  def change
    create_table   :matches do |t|
      t.integer    :team1_id
      t.integer    :team2_id
      t.string     :name, null: false
      t.references :game, index: true
      t.references :tournament, index: true
      t.timestamps

      add_foreign_key :teams, column: :team1_id
      add_foreign_key :teams, column: :team2_id
    end
  end
end
