parent
927e02e051
commit
7742f440fa
2 changed files with 19 additions and 9 deletions
|
@ -13,6 +13,7 @@ class AddMasterSettingsToAccounts < ActiveRecord::Migration[7.1]
|
|||
safety_assured do
|
||||
add_column :accounts, :master_settings, :jsonb
|
||||
|
||||
if Rails.env.test?
|
||||
Account.transaction do
|
||||
Account.find_in_batches do |accounts|
|
||||
accounts.each do |account|
|
||||
|
@ -20,6 +21,10 @@ class AddMasterSettingsToAccounts < ActiveRecord::Migration[7.1]
|
|||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Account.where(dissubscribable: true).update_all(master_settings: { 'subscription_policy' => 'block' }) # rubocop:disable Rails/SkipsModelValidations
|
||||
Account.where(dissubscribable: false).update_all(master_settings: { 'subscription_policy' => 'allow' }) # rubocop:disable Rails/SkipsModelValidations
|
||||
end
|
||||
|
||||
remove_column :accounts, :dissubscribable
|
||||
end
|
||||
|
@ -29,6 +34,7 @@ class AddMasterSettingsToAccounts < ActiveRecord::Migration[7.1]
|
|||
safety_assured do
|
||||
add_column_with_default :accounts, :dissubscribable, :boolean, default: false, allow_null: false
|
||||
|
||||
if Rails.env.test?
|
||||
Account.transaction do
|
||||
Account.find_in_batches do |accounts|
|
||||
accounts.each do |account|
|
||||
|
@ -36,6 +42,10 @@ class AddMasterSettingsToAccounts < ActiveRecord::Migration[7.1]
|
|||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Account.where(master_settings: { subscription_policy: 'block' }).update_all(dissubscribable: true) # rubocop:disable Rails/SkipsModelValidations
|
||||
Account.where(master_settings: { subscription_policy: 'allow' }).update_all(dissubscribable: false) # rubocop:disable Rails/SkipsModelValidations
|
||||
end
|
||||
|
||||
remove_column :accounts, :master_settings
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ module Mastodon
|
|||
module_function
|
||||
|
||||
def kmyblue_major
|
||||
8
|
||||
9
|
||||
end
|
||||
|
||||
def kmyblue_minor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue