20220310060854_optimize_null_index_appeals_approved_by_account_id.rb 513 B

1234567891011121314151617
  1. # frozen_string_literal: true
  2. require Rails.root.join('lib', 'mastodon', 'migration_helpers')
  3. class OptimizeNullIndexAppealsApprovedByAccountId < ActiveRecord::Migration[5.2]
  4. include Mastodon::MigrationHelpers
  5. disable_ddl_transaction!
  6. def up
  7. update_index :appeals, 'index_appeals_on_approved_by_account_id', :approved_by_account_id, where: 'approved_by_account_id IS NOT NULL'
  8. end
  9. def down
  10. update_index :appeals, 'index_appeals_on_approved_by_account_id', :approved_by_account_id
  11. end
  12. end