このコミットが含まれているのは:
2026-06-08 08:45:52 +09:00
コミット fb2b2a632c
4個のファイルの変更33行の追加11行の削除
@@ -0,0 +1,17 @@
class RequireGekanatorGameUserAndCorrectPost < ActiveRecord::Migration[8.0]
def up
execute <<~SQL.squish
UPDATE gekanator_games
SET correct_post_id = guessed_post_id
WHERE correct_post_id IS NULL
SQL
change_column_null :gekanator_games, :user_id, false
change_column_null :gekanator_games, :correct_post_id, false
end
def down
change_column_null :gekanator_games, :correct_post_id, true
change_column_null :gekanator_games, :user_id, true
end
end
生成ファイル
+3 -3
ファイルの表示
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2026_06_07_000000) do
ActiveRecord::Schema[8.0].define(version: 2026_06_08_000000) do
create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
@@ -49,9 +49,9 @@ ActiveRecord::Schema[8.0].define(version: 2026_06_07_000000) do
end
create_table "gekanator_games", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
t.bigint "user_id"
t.bigint "user_id", null: false
t.bigint "guessed_post_id", null: false
t.bigint "correct_post_id"
t.bigint "correct_post_id", null: false
t.boolean "won", null: false
t.integer "question_count", null: false
t.json "answers", null: false