commit
58946fef3c
@ -1,5 +1,5 @@ |
||||
class AddForeignKeyToAccountModerationNotes < ActiveRecord::Migration[5.1] |
||||
def change |
||||
add_foreign_key :account_moderation_notes, :accounts |
||||
safety_assured { add_foreign_key :account_moderation_notes, :accounts } |
||||
end |
||||
end |
||||
|
@ -1,6 +1,6 @@ |
||||
class AddMovedToAccountIdToAccounts < ActiveRecord::Migration[5.1] |
||||
def change |
||||
add_column :accounts, :moved_to_account_id, :bigint, null: true, default: nil |
||||
add_foreign_key :accounts, :accounts, column: :moved_to_account_id, on_delete: :nullify |
||||
safety_assured { add_foreign_key :accounts, :accounts, column: :moved_to_account_id, on_delete: :nullify } |
||||
end |
||||
end |
||||
|
@ -0,0 +1,17 @@ |
||||
class PreserveOldLayoutForExistingUsers < ActiveRecord::Migration[5.2] |
||||
disable_ddl_transaction! |
||||
|
||||
def up |
||||
# Assume that currently active users are already using the layout that they |
||||
# want to use, therefore ensure that it is saved explicitly and not based |
||||
# on the to-be-changed default |
||||
|
||||
User.where(User.arel_table[:current_sign_in_at].gteq(1.month.ago)).find_each do |user| |
||||
next if Setting.unscoped.where(thing_type: 'User', thing_id: user.id, var: 'advanced_layout').exists? |
||||
user.settings.advanced_layout = true |
||||
end |
||||
end |
||||
|
||||
def down |
||||
end |
||||
end |
Loading…
Reference in new issue