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
|
||||
Reference in New Issue
Block a user