diff options
Diffstat (limited to 'db/post_migrate/20220310060854_optimize_null_index_appeals_approved_by_account_id.rb')
-rw-r--r-- | db/post_migrate/20220310060854_optimize_null_index_appeals_approved_by_account_id.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20220310060854_optimize_null_index_appeals_approved_by_account_id.rb b/db/post_migrate/20220310060854_optimize_null_index_appeals_approved_by_account_id.rb new file mode 100644 index 000000000..244b89417 --- /dev/null +++ b/db/post_migrate/20220310060854_optimize_null_index_appeals_approved_by_account_id.rb @@ -0,0 +1,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 |