set request_for_comment.solved default to false and set all null values in database for that attribute to false

This commit is contained in:
Ralf Teusner
2017-04-03 19:51:32 +02:00
parent 58f76f53e6
commit b1f9f1cc92
2 changed files with 11 additions and 5 deletions

View File

@ -0,0 +1,6 @@
class SetDefaultForRequestForCommentSolved < ActiveRecord::Migration
def change
change_column_default :request_for_comments, :solved, false
RequestForComment.where(solved: nil).update_all(solved: false)
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170323130756) do ActiveRecord::Schema.define(version: 20170403162848) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -239,14 +239,14 @@ ActiveRecord::Schema.define(version: 20170323130756) do
end end
create_table "request_for_comments", force: :cascade do |t| create_table "request_for_comments", force: :cascade do |t|
t.integer "user_id", null: false t.integer "user_id", null: false
t.integer "exercise_id", null: false t.integer "exercise_id", null: false
t.integer "file_id", null: false t.integer "file_id", null: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "user_type", limit: 255 t.string "user_type", limit: 255
t.text "question" t.text "question"
t.boolean "solved" t.boolean "solved", default: false
t.integer "submission_id" t.integer "submission_id"
end end