mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-12-25 04:53:06 +00:00
Merge branch 'fix-dm-index' into 'develop'
Massage index until it actually does the stuff we want. See merge request pleroma/pleroma!772
This commit is contained in:
commit
d120aa63f0
|
@ -521,7 +521,7 @@ defp restrict_actor(query, %{"actor_id" => actor_id}) do
|
|||
defp restrict_actor(query, _), do: query
|
||||
|
||||
defp restrict_type(query, %{"type" => type}) when is_binary(type) do
|
||||
restrict_type(query, %{"type" => [type]})
|
||||
from(activity in query, where: fragment("?->>'type' = ?", activity.data, ^type))
|
||||
end
|
||||
|
||||
defp restrict_type(query, %{"type" => type}) do
|
||||
|
|
30
priv/repo/migrations/20190204200237_add_correct_dm_index.exs
Normal file
30
priv/repo/migrations/20190204200237_add_correct_dm_index.exs
Normal file
|
@ -0,0 +1,30 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddCorrectDMIndex do
|
||||
use Ecto.Migration
|
||||
@disable_ddl_transaction true
|
||||
|
||||
def up do
|
||||
drop_if_exists(
|
||||
index(:activities, ["activity_visibility(actor, recipients, data)"],
|
||||
name: :activities_visibility_index
|
||||
)
|
||||
)
|
||||
|
||||
create(
|
||||
index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC NULLS LAST"],
|
||||
name: :activities_visibility_index,
|
||||
concurrently: true,
|
||||
where: "data->>'type' = 'Create'"
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
def down do
|
||||
drop(
|
||||
index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC"],
|
||||
name: :activities_visibility_index,
|
||||
concurrently: true,
|
||||
where: "data->>'type' = 'Create'"
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue