Add index on inReplyTo for objects
authorrinpatch <rinpatch@sdf.org>
Mon, 3 Jun 2019 16:26:43 +0000 (19:26 +0300)
committerrinpatch <rinpatch@sdf.org>
Mon, 3 Jun 2019 16:26:43 +0000 (19:26 +0300)
Fixes the performance of `get_existing_votes`

priv/repo/migrations/20190603162018_add_object_in_reply_to_index.exs [new file with mode: 0644]

diff --git a/priv/repo/migrations/20190603162018_add_object_in_reply_to_index.exs b/priv/repo/migrations/20190603162018_add_object_in_reply_to_index.exs
new file mode 100644 (file)
index 0000000..df4ac77
--- /dev/null
@@ -0,0 +1,7 @@
+defmodule Pleroma.Repo.Migrations.AddObjectInReplyToIndex do
+  use Ecto.Migration
+
+  def change do
+    create index(:objects, ["(data->>'inReplyTo')"], name: :objects_in_reply_to_index)
+  end
+end