1 defmodule Pleroma.Repo.Migrations.CreateChats do
5 create table(:chats) do
6 add(:user_id, references(:users, type: :uuid))
7 # Recipient is an ActivityPub id, to future-proof for group support.
8 add(:recipient, :string)
9 add(:unread, :integer, default: 0)
13 # There's only one chat between a user and a recipient.
14 create(index(:chats, [:user_id, :recipient], unique: true))