about summary refs log tree commit diff
path: root/db/migrate/20171125190735_remove_old_reblog_index_on_statuses.rb
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2017-11-27 20:17:12 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2017-11-27 20:17:12 +0000
commit63d47e04c4b22fc5caf5e6f4d0156040c91339fe (patch)
tree49d101afef2356fc40040004142db4f9dedbc82e /db/migrate/20171125190735_remove_old_reblog_index_on_statuses.rb
parente77c3996a513a45e5cad368b0053459f303c60cb (diff)
parentc6b7c772293ed1319dc57741487ce5bc774558a9 (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'db/migrate/20171125190735_remove_old_reblog_index_on_statuses.rb')
-rw-r--r--db/migrate/20171125190735_remove_old_reblog_index_on_statuses.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/db/migrate/20171125190735_remove_old_reblog_index_on_statuses.rb b/db/migrate/20171125190735_remove_old_reblog_index_on_statuses.rb
new file mode 100644
index 000000000..68146c5ce
--- /dev/null
+++ b/db/migrate/20171125190735_remove_old_reblog_index_on_statuses.rb
@@ -0,0 +1,14 @@
+class RemoveOldReblogIndexOnStatuses < ActiveRecord::Migration[5.1]
+  disable_ddl_transaction!
+
+  def up
+    # This index may not exists (see migration 20171122120436)
+    remove_index :statuses, [:account_id, :reblog_of_id] if index_exists?(:statuses, [:account_id, :reblog_of_id])
+
+    remove_index :statuses, :reblog_of_id
+  end
+
+  def down
+    add_index :statuses, :reblog_of_id, algorithm: :concurrently
+  end
+end