class CreateSubjectShixunInfos < ActiveRecord::Migration[5.2]
  def change
    create_table :subject_shixun_infos do |t|
      t.references :subject
      t.references :shixun
      t.string :stage
      t.string :shixun_name
      t.integer :challenge_count, default: 0
      t.integer :course_count, default: 0
      t.integer :school_count, default: 0
      t.integer :used_count, default: 0
      t.integer :passed_count, default: 0
      t.integer :evaluate_count, default: 0
      t.integer :passed_ave_time, default: 0

      t.timestamps
    end

    add_index :subject_shixun_infos, [:shixun_id, :subject_id], unique: true
  end
end
