about summary refs log tree commit diff
path: root/db/post_migrate/20220310060926_optimize_null_index_appeals_rejected_by_account_id.rb
blob: 017333c266bab439b02a1e32e2f94c7381f3372d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

require Rails.root.join('lib', 'mastodon', 'migration_helpers')

class OptimizeNullIndexAppealsRejectedByAccountId < ActiveRecord::Migration[5.2]
  include Mastodon::MigrationHelpers

  disable_ddl_transaction!

  def up
    update_index :appeals, 'index_appeals_on_rejected_by_account_id', :rejected_by_account_id, where: 'rejected_by_account_id IS NOT NULL'
  end

  def down
    update_index :appeals, 'index_appeals_on_rejected_by_account_id', :rejected_by_account_id
  end
end