class CreateCovidTemperatures < ActiveRecord::Migration[6.0]
  def change
    create_table :covid_temperatures do |t|
      t.references :student, type: :integer, null: false,
        foreign_key: { to_table: :Students, primary_key: :StudentID }

      t.datetime :recorded_at, null: false
      t.string :recorded_by, null: false
      t.decimal :temperature, null: false, scale: 1, precision: 4

      t.timestamps

      t.index [:student_id, :recorded_at]
    end
  end
end
