From cd13b92a3b66af08a7bfd3d1a8b9a906ed0cdaae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Fri, 27 May 2022 13:51:46 +0200 Subject: [PATCH] Add index for quoteUrl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- lib/pleroma/web/activity_pub/activity_pub.ex | 2 -- .../20220527134341_add_quote_url_index_to_objects.exs | 11 +++++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 priv/repo/migrations/20220527134341_add_quote_url_index_to_objects.exs diff --git a/lib/pleroma/web/activity_pub/activity_pub.ex b/lib/pleroma/web/activity_pub/activity_pub.ex index 3add644c19..3f94c59b25 100644 --- a/lib/pleroma/web/activity_pub/activity_pub.ex +++ b/lib/pleroma/web/activity_pub/activity_pub.ex @@ -1216,8 +1216,6 @@ defp restrict_filtered(query, %{blocking_user: %User{} = user}) do defp restrict_filtered(query, _), do: query defp restrict_quote_url(query, %{quote_url: quote_url}) do - IO.inspect(quote_url) - from([_activity, object] in query, where: fragment("(?)->'quoteUrl' = ?", object.data, ^quote_url) ) diff --git a/priv/repo/migrations/20220527134341_add_quote_url_index_to_objects.exs b/priv/repo/migrations/20220527134341_add_quote_url_index_to_objects.exs new file mode 100644 index 0000000000..c746f12a14 --- /dev/null +++ b/priv/repo/migrations/20220527134341_add_quote_url_index_to_objects.exs @@ -0,0 +1,11 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2022 Pleroma Authors +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Repo.Migrations.AddQuoteUrlIndexToObjects do + use Ecto.Migration + + def change do + create_if_not_exists(index(:objects, ["(data->'quoteUrl')"], name: :objects_quote_url)) + end +end