summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20200309123730_create_chats.exs
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-03-09 17:00:16 +0100
committerlain <lain@soykaf.club>2020-04-02 15:19:09 +0200
commitfd97b0e634d30dec3217efcf3d67610d1b54bf8b (patch)
tree4858018c8f49a64f36b45eeaaa00f0ed972b3971 /priv/repo/migrations/20200309123730_create_chats.exs
parent037b49c415060b4c7ad5a570da80857b4d2c43f1 (diff)
downloadpleroma-fd97b0e634d30dec3217efcf3d67610d1b54bf8b.tar.gz
pleroma-fd97b0e634d30dec3217efcf3d67610d1b54bf8b.zip
Chats: Basic implementation.
Diffstat (limited to 'priv/repo/migrations/20200309123730_create_chats.exs')
-rw-r--r--priv/repo/migrations/20200309123730_create_chats.exs16
1 files changed, 16 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200309123730_create_chats.exs b/priv/repo/migrations/20200309123730_create_chats.exs
new file mode 100644
index 000000000..715d798ea
--- /dev/null
+++ b/priv/repo/migrations/20200309123730_create_chats.exs
@@ -0,0 +1,16 @@
+defmodule Pleroma.Repo.Migrations.CreateChats do
+ use Ecto.Migration
+
+ def change do
+ create table(:chats) do
+ add(:user_id, references(:users, type: :uuid))
+ # Recipient is an ActivityPub id, to future-proof for group support.
+ add(:recipient, :string)
+ add(:unread, :integer, default: 0)
+ timestamps()
+ end
+
+ # There's only one chat between a user and a recipient.
+ create(index(:chats, [:user_id, :recipient], unique: true))
+ end
+end