From 73f222d76a03e7bfad1aae80e0dc9d2777a94f3e Mon Sep 17 00:00:00 2001 From: lain Date: Wed, 27 May 2020 12:56:15 +0200 Subject: [PATCH] Migrations: Make user_id index on notifications better for query. --- .../20200527104138_change_notification_user_index.exs | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 priv/repo/migrations/20200527104138_change_notification_user_index.exs 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