about summary refs log tree commit diff
path: root/db/post_migrate/20220310060854_optimize_null_index_appeals_approved_by_account_id.rb
blob: 244b89417185a08de7dce108f5669c70a05c5637 (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 OptimizeNullIndexAppealsApprovedByAccountId < ActiveRecord::Migration[5.2]
  include Mastodon::MigrationHelpers

  disable_ddl_transaction!

  def up
    update_index :appeals, 'index_appeals_on_approved_by_account_id', :approved_by_account_id, where: 'approved_by_account_id IS NOT NULL'
  end

  def down
    update_index :appeals, 'index_appeals_on_approved_by_account_id', :approved_by_account_id
  end
end