6
0
Ответвление 0
bastodon/db/post_migrate/20200917222734_remove_index_notifications_on_account_activity.rb
Eugen Rochko 974b1b79ce
Add option to be notified when a followed user posts (#13546)
* Add bell button

Fix #4890

* Remove duplicate type from post-deployment migration

* Fix legacy class type mappings

* Improve query performance with better index

* Fix validation

* Remove redundant index from notifications
2020-09-18 17:26:45 +02:00

15 строки
550 Б
Ruby

# frozen_string_literal: true
class RemoveIndexNotificationsOnAccountActivity < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def up
remove_index :notifications, name: :account_activity
remove_index :notifications, name: :index_notifications_on_account_id_and_id
end
def down
add_index :notifications, [:account_id, :activity_id, :activity_type], unique: true, name: 'account_activity', algorithm: :concurrently
add_index :notifications, [:account_id, :id], order: { id: :desc }, algorithm: :concurrently
end
end