Add index for quoteUrl

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2022-05-27 13:51:46 +02:00
parent 8d1617f439
commit cd13b92a3b
2 changed files with 11 additions and 2 deletions

View file

@ -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)
)

View file

@ -0,0 +1,11 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# 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