class CreateAdmissionFamilies < ActiveRecord::Migration[6.0]
  def change
    create_table :admission_families do |t|
      t.references :family, type: :integer, null: false,
        foreign_key: { to_table: :Families, primary_key: :FamilyID }
      t.references :school_year, type: :integer, null: false,
        foreign_key: { to_table: :SchoolYears, primary_key: :SchoolYearID }

      t.index [:family_id, :school_year_id], unique: true
    end
  end
end
