logo

pleroma

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

20190408123347_create_conversations.exs (921B)


  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.CreateConversations do
  5. use Ecto.Migration
  6. def change do
  7. create_if_not_exists table(:conversations) do
  8. add(:ap_id, :string, null: false)
  9. timestamps()
  10. end
  11. create_if_not_exists table(:conversation_participations) do
  12. add(:user_id, references(:users, type: :uuid, on_delete: :delete_all))
  13. add(:conversation_id, references(:conversations, on_delete: :delete_all))
  14. add(:read, :boolean, default: false)
  15. timestamps()
  16. end
  17. create_if_not_exists(index(:conversation_participations, [:conversation_id]))
  18. create_if_not_exists(unique_index(:conversation_participations, [:user_id, :conversation_id]))
  19. create_if_not_exists(unique_index(:conversations, [:ap_id]))
  20. end
  21. end