summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20190408123347_create_conversations.exs
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2019-04-10 09:34:53 +0200
committerlain <lain@soykaf.club>2019-04-10 15:01:42 +0200
commitd1da6b155ab758ae4eb8fa154997a0a2a179897c (patch)
tree3a52029fa49619db4dff6db41933d623f07d0bae /priv/repo/migrations/20190408123347_create_conversations.exs
parentb5cecebbc14c80d08f1a9f541722218c48dc514f (diff)
downloadpleroma-d1da6b155ab758ae4eb8fa154997a0a2a179897c.tar.gz
pleroma-d1da6b155ab758ae4eb8fa154997a0a2a179897c.zip
Conversation: Add Conversations and Participations.
Diffstat (limited to 'priv/repo/migrations/20190408123347_create_conversations.exs')
-rw-r--r--priv/repo/migrations/20190408123347_create_conversations.exs26
1 files changed, 26 insertions, 0 deletions
diff --git a/priv/repo/migrations/20190408123347_create_conversations.exs b/priv/repo/migrations/20190408123347_create_conversations.exs
new file mode 100644
index 000000000..68bf766bc
--- /dev/null
+++ b/priv/repo/migrations/20190408123347_create_conversations.exs
@@ -0,0 +1,26 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2019 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.CreateConversations do
+ use Ecto.Migration
+
+ def change do
+ create table(:conversations) do
+ add(:ap_id, :string, null: false)
+ timestamps()
+ end
+
+ create table(:conversation_participations) do
+ add(:user_id, references(:users, type: :uuid, on_delete: :delete_all))
+ add(:conversation_id, references(:conversations, on_delete: :delete_all))
+ add(:read, :boolean, default: false)
+
+ timestamps()
+ end
+
+ create index(:conversation_participations, [:user_id])
+ create index(:conversation_participations, [:conversation_id])
+ create unique_index(:conversations, [:ap_id])
+ end
+end