about summary refs log tree commit diff
path: root/db/post_migrate/20220310060926_optimize_null_index_appeals_rejected_by_account_id.rb
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-03-12 20:54:13 +0100
committerGitHub <noreply@github.com>2022-03-12 20:54:13 +0100
commit988f5bf0266483659b03f1b0926d0b9ff9e85a8f (patch)
tree1e0a0011a890729f45c0d364641c266864e78d02 /db/post_migrate/20220310060926_optimize_null_index_appeals_rejected_by_account_id.rb
parent2c8bb1745359a3bf200d37383dc56d5951e2b6bc (diff)
parent8d4b5ee3ef5e8df3a92e19f2c3f3a4560341eef3 (diff)
Merge pull request #1716 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'db/post_migrate/20220310060926_optimize_null_index_appeals_rejected_by_account_id.rb')
-rw-r--r--db/post_migrate/20220310060926_optimize_null_index_appeals_rejected_by_account_id.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/db/post_migrate/20220310060926_optimize_null_index_appeals_rejected_by_account_id.rb b/db/post_migrate/20220310060926_optimize_null_index_appeals_rejected_by_account_id.rb
new file mode 100644
index 000000000..017333c26
--- /dev/null
+++ b/db/post_migrate/20220310060926_optimize_null_index_appeals_rejected_by_account_id.rb
@@ -0,0 +1,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