feat: posts.thumbnail_base を Nullable に(#75) (#198)
Merge remote-tracking branch 'origin/main' into feature/075 #75 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #198
This commit was merged in pull request #198.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
class MakeThumbnailBaseNullableInPosts < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
change_column_null :posts, :thumbnail_base, true
|
||||
|
||||
execute <<~SQL
|
||||
UPDATE
|
||||
posts
|
||||
SET
|
||||
thumbnail_base = NULL
|
||||
WHERE
|
||||
thumbnail_base = ''
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
execute <<~SQL
|
||||
UPDATE
|
||||
posts
|
||||
SET
|
||||
thumbnail_base = ''
|
||||
WHERE
|
||||
thumbnail_base IS NULL
|
||||
SQL
|
||||
|
||||
change_column_null :posts, :thumbnail_base, false
|
||||
end
|
||||
end
|
||||
Generated
+2
-2
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_12_29_022100) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_12_30_143400) 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
|
||||
@@ -86,7 +86,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_12_29_022100) do
|
||||
create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
|
||||
t.string "title", null: false
|
||||
t.string "url", limit: 2000, null: false
|
||||
t.string "thumbnail_base", limit: 2000, null: false
|
||||
t.string "thumbnail_base", limit: 2000
|
||||
t.bigint "parent_id"
|
||||
t.bigint "uploaded_user_id"
|
||||
t.datetime "created_at", null: false
|
||||
|
||||
Reference in New Issue
Block a user