class CreateSubjectCourseRecords < ActiveRecord::Migration[5.2]
  def change
    create_table :subject_course_records do |t|
      t.references :subject
      t.references :school
      t.string :school_name
      t.integer :course_count, default: 0
      t.integer :student_count, default: 0
      t.integer :choice_shixun_num, default: 0
      t.integer :choice_shixun_frequency, default: 0
      t.timestamps
    end

    add_index :subject_course_records, [:school_id, :subject_id], unique: true, name: "couse_and_school_index"
  end
end
