Solve remaining db/*migrate*
cops (#28579)
This commit is contained in:
parent
d0fd14f851
commit
ae39bed95b
5 changed files with 54 additions and 41 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue