diff --git a/app/models/team.rb b/app/models/team.rb index ab022b6..b2979cb 100644 --- a/app/models/team.rb +++ b/app/models/team.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true class Team < ApplicationRecord + belongs_to :tournament end diff --git a/db/migrate/0000_create_schema.rb b/db/migrate/0000_create_schema.rb index 67a6347..845e12c 100644 --- a/db/migrate/0000_create_schema.rb +++ b/db/migrate/0000_create_schema.rb @@ -36,6 +36,8 @@ class CreateSchema < ActiveRecord::Migration[5.2] t.integer :group_points_scored t.integer :group_points_recieved + t.belongs_to :tournament, index: true, null: false, foreign_key: { on_delete: :cascade } + t.timestamps end