fix review request constraint

This commit is contained in:
2023-05-03 21:23:09 -03:00
parent afb827dae3
commit 6a31c0de64
6 changed files with 18 additions and 7 deletions

View File

@@ -0,0 +1,7 @@
class ChangeReviewRequestAnsweredToNotNil < ActiveRecord::Migration[7.0]
def change
ReviewRequest.where(answered: nil).update_all(answered: false)
change_column_null :review_requests, :answered, false
end
end

4
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2022_08_05_233401) do
ActiveRecord::Schema[7.0].define(version: 2023_05_04_002009) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -110,7 +110,7 @@ ActiveRecord::Schema[7.0].define(version: 2022_08_05_233401) do
end
create_table "review_requests", force: :cascade do |t|
t.string "answered"
t.string "answered", null: false
t.bigint "question_id", null: false
t.bigint "user_id", null: false
t.datetime "created_at", null: false