Add timestamps to academic years table

This commit is contained in:
Nelson Jovel 2022-05-03 11:11:17 -07:00
parent bc27e5a0e8
commit a613f6cb93
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,10 @@
class AddTimestampsToAcademicYear < ActiveRecord::Migration[7.0]
def change
now = Time.zone.now
change_table :academic_years do |t|
t.timestamps default: now
end
change_column_default :academic_years, :created_at, from: now, to: nil
change_column_default :academic_years, :updated_at, from: now, to: nil
end
end

View file

@ -10,13 +10,15 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2022_04_05_174019) do
ActiveRecord::Schema[7.0].define(version: 2022_05_03_180142) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_stat_statements"
enable_extension "plpgsql"
create_table "academic_years", id: :serial, force: :cascade do |t|
t.string "range", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["range"], name: "index_academic_years_on_range", unique: true
end