0
0
Fork 0

Solve remaining db/*migrate* cops (#28579)

This commit is contained in:
Matt Jankowski 2024-01-04 11:40:28 -05:00 committed by GitHub
parent d0fd14f851
commit ae39bed95b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 41 deletions

View file

@ -22,11 +22,9 @@ class TruncatePreviewCards < ActiveRecord::Migration[5.1]
end
def down
if ActiveRecord::Base.connection.table_exists? 'deprecated_preview_cards'
drop_table :preview_cards
rename_table :deprecated_preview_cards, :preview_cards
else
raise ActiveRecord::IrreversibleMigration, 'Previous preview cards table has already been removed'
end
raise ActiveRecord::IrreversibleMigration, 'Previous preview cards table has already been removed' unless ActiveRecord::Base.connection.table_exists? 'deprecated_preview_cards'
drop_table :preview_cards
rename_table :deprecated_preview_cards, :preview_cards
end
end

View file

@ -105,7 +105,7 @@ class MigrateAccountConversations < ActiveRecord::Migration[5.2]
end
end
notifications_about_direct_statuses.includes(:account, mention: { status: [:account, mentions: :account] }).find_each do |notification|
notifications_about_direct_statuses.includes(:account, mention: { status: [:account, { mentions: :account }] }).find_each do |notification|
MigrationAccountConversation.add_status(notification.account, notification.target_status)
migrated += 1

View file

@ -9,7 +9,7 @@ class PreserveOldLayoutForExistingUsers < ActiveRecord::Migration[5.2]
# 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?
next if Setting.unscoped.exists?(thing_type: 'User', thing_id: user.id, var: 'advanced_layout')
user.settings.advanced_layout = true
end