Add missing tag index on objects
authorrinpatch <rinpatch@sdf.org>
Mon, 3 Jun 2019 17:42:08 +0000 (20:42 +0300)
committerrinpatch <rinpatch@sdf.org>
Mon, 3 Jun 2019 17:42:13 +0000 (20:42 +0300)
The previous activity index is useless because objects are not embedded
anymore and instead a joined object is queried.

priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs [new file with mode: 0644]

diff --git a/priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs b/priv/repo/migrations/20190603173419_add_tag_index_to_objects.exs
new file mode 100644 (file)
index 0000000..c915a02
--- /dev/null
@@ -0,0 +1,8 @@
+defmodule Pleroma.Repo.Migrations.AddTagIndexToObjects do
+  use Ecto.Migration
+
+  def change do
+    drop_if_exists index(:activities, ["(data #> '{\"object\",\"tag\"}')"], using: :gin, name: :activities_tags)
+    create index(:objects, ["(data->'tag')"], using: :gin, name: :objects_tags)
+  end
+end