1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Repo.Migrations.CreateChats do
9 create table(:chats) do
10 add(:user_id, references(:users, type: :uuid))
11 # Recipient is an ActivityPub id, to future-proof for group support.
12 add(:recipient, :string)
13 add(:unread, :integer, default: 0)
17 # There's only one chat between a user and a recipient.
18 create(index(:chats, [:user_id, :recipient], unique: true))