Add: #437 ドメインブロックで「未ログインユーザーに非公開」の設定を「非公開」にコピーするマイグレーションコード (#439)

* Add: #437 ドメインブロックで「未ログインユーザーに非公開」の設定を「非公開」にコピーするマイグレーションコード

* Fix test for LTS

* Fix test
This commit is contained in:
KMY(雪あすか) 2024-01-09 16:19:23 +09:00 committed by GitHub
parent 4719ca6525
commit 7694c62bc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 26 deletions

View file

@ -0,0 +1,18 @@
# frozen_string_literal: true
class RemoveHiddenAnonymousFromDomainBlocks < ActiveRecord::Migration[7.0]
class DomainBlock < ApplicationRecord; end
def up
safety_assured do
DomainBlock.where(hidden_anonymous: true, hidden: false).update_all(hidden: true)
remove_column :domain_blocks, :hidden_anonymous
end
end
def down
safety_assured do
add_column :domain_blocks, :hidden_anonymous, :boolean, null: false, default: false
end
end
end