From: lain Date: Wed, 27 May 2020 10:56:15 +0000 (+0200) Subject: Migrations: Make user_id index on notifications better for query. X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=73f222d76a03e7bfad1aae80e0dc9d2777a94f3e;p=akkoma Migrations: Make user_id index on notifications better for query. --- diff --git a/priv/repo/migrations/20200527104138_change_notification_user_index.exs b/priv/repo/migrations/20200527104138_change_notification_user_index.exs new file mode 100644 index 000000000..4dcfe6de9 --- /dev/null +++ b/priv/repo/migrations/20200527104138_change_notification_user_index.exs @@ -0,0 +1,8 @@ +defmodule Pleroma.Repo.Migrations.ChangeNotificationUserIndex do + use Ecto.Migration + + def change do + drop_if_exists(index(:notifications, [:user_id])) + create_if_not_exists(index(:notifications, [:user_id, "id desc nulls last"])) + end +end