about summary refs log tree commit diff
path: root/db/post_migrate/20200917222734_remove_index_notifications_on_account_activity.rb
blob: cb7f78e53bffddf230bc765b32b5cb15549b0cbc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 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