Created
October 4, 2017 20:56
-
-
Save searls/6f930cd45e9fd91de11ca4cae753e318 to your computer and use it in GitHub Desktop.
TFW you forget to run `t.timestamps` in all your migrations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddTimestampsEverywhere < ActiveRecord::Migration[5.1] | |
def change | |
change_table :candidates do |t| | |
t.timestamps default: Time.zone.now | |
end | |
change_table :evaluations do |t| | |
t.timestamps default: Time.zone.now | |
end | |
change_table :interviewers do |t| | |
t.timestamps default: Time.zone.now | |
end | |
change_table :questions do |t| | |
t.timestamps default: Time.zone.now | |
end | |
change_table :responses do |t| | |
t.timestamps default: Time.zone.now | |
end | |
change_table :stages do |t| | |
t.timestamps default: Time.zone.now | |
end | |
change_table :workflows do |t| | |
t.timestamps default: Time.zone.now | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RemoveDefaultTimestamp < ActiveRecord::Migration[5.1] | |
def change | |
change_column_default :candidates, :created_at, from: Time.zone.now, to: nil | |
change_column_default :candidates, :updated_at, from: Time.zone.now, to: nil | |
change_column_default :evaluations, :created_at, from: Time.zone.now, to: nil | |
change_column_default :evaluations, :updated_at, from: Time.zone.now, to: nil | |
change_column_default :interviewers, :created_at, from: Time.zone.now, to: nil | |
change_column_default :interviewers, :updated_at, from: Time.zone.now, to: nil | |
change_column_default :questions, :created_at, from: Time.zone.now, to: nil | |
change_column_default :questions, :updated_at, from: Time.zone.now, to: nil | |
change_column_default :responses, :created_at, from: Time.zone.now, to: nil | |
change_column_default :responses, :updated_at, from: Time.zone.now, to: nil | |
change_column_default :stages, :created_at, from: Time.zone.now, to: nil | |
change_column_default :stages, :updated_at, from: Time.zone.now, to: nil | |
change_column_default :workflows, :created_at, from: Time.zone.now, to: nil | |
change_column_default :workflows, :updated_at, from: Time.zone.now, to: nil | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/db/schema.rb b/db/schema.rb | |
index b41a2be..9aef2cd 100644 | |
--- a/db/schema.rb | |
+++ b/db/schema.rb | |
@@ -10,7 +10,7 @@ | |
# | |
# It's strongly recommended that you check this file into your version control system. | |
-ActiveRecord::Schema.define(version: 20171002174824) do | |
+ActiveRecord::Schema.define(version: 20171004204600) do | |
# These are extensions that must be enabled in order to support this database | |
enable_extension "plpgsql" | |
@@ -24,6 +24,8 @@ ActiveRecord::Schema.define(version: 20171002174824) do | |
t.string "card_url" | |
t.bigint "stage_id" | |
t.boolean "active", default: true | |
+ t.datetime "created_at", null: false | |
+ t.datetime "updated_at", null: false | |
t.index ["stage_id"], name: "index_candidates_on_stage_id" | |
end | |
@@ -32,11 +34,15 @@ ActiveRecord::Schema.define(version: 20171002174824) do | |
t.text "purpose" | |
t.text "preamble" | |
t.text "prep_notes" | |
+ t.datetime "created_at", null: false | |
+ t.datetime "updated_at", null: false | |
end | |
create_table "interviewers", force: :cascade do |t| | |
t.string "name", null: false | |
t.string "email", null: false | |
+ t.datetime "created_at", null: false | |
+ t.datetime "updated_at", null: false | |
end | |
create_table "interviews", force: :cascade do |t| | |
@@ -65,6 +71,8 @@ ActiveRecord::Schema.define(version: 20171002174824) do | |
t.text "to_earn_a_5" | |
t.text "notes" | |
t.bigint "evaluation_id" | |
+ t.datetime "created_at", null: false | |
+ t.datetime "updated_at", null: false | |
t.index ["evaluation_id"], name: "index_questions_on_evaluation_id" | |
t.index ["id", "position"], name: "index_questions_on_id_and_position", unique: true | |
end | |
@@ -77,6 +85,8 @@ ActiveRecord::Schema.define(version: 20171002174824) do | |
t.text "evaluator_notes" | |
t.integer "score_out_of_times_ten", default: 50 | |
t.bigint "interview_id" | |
+ t.datetime "created_at", null: false | |
+ t.datetime "updated_at", null: false | |
t.index ["interview_id", "question_id"], name: "index_responses_on_interview_id_and_question_id", unique: true | |
t.index ["interview_id"], name: "index_responses_on_interview_id" | |
t.index ["question_id"], name: "index_responses_on_question_id" | |
@@ -87,12 +97,16 @@ ActiveRecord::Schema.define(version: 20171002174824) do | |
t.integer "position" | |
t.string "name" | |
t.bigint "evaluation_id" | |
+ t.datetime "created_at", null: false | |
+ t.datetime "updated_at", null: false | |
t.index ["evaluation_id"], name: "index_stages_on_evaluation_id" | |
t.index ["workflow_id"], name: "index_stages_on_workflow_id" | |
end | |
create_table "workflows", force: :cascade do |t| | |
t.string "name" | |
+ t.datetime "created_at", null: false | |
+ t.datetime "updated_at", null: false | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment