Migrations: Add chat_id, seen index to ChatMessageReferences
This ensures fast count of unseen messages
This commit is contained in:
parent
1e9efcf7c3
commit
7b79871e97
|
@ -0,0 +1,12 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.AddSeenIndexToChatMessageReferences do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
create(
|
||||||
|
index(:chat_message_references, [:chat_id],
|
||||||
|
where: "seen = false",
|
||||||
|
name: "unseen_messages_count_index"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue