logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

20200309123730_create_chats.exs (636B)


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