summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20190408123347_create_conversations.exs
diff options
context:
space:
mode:
authorMaksim <parallel588@gmail.com>2019-07-01 01:08:07 +0000
committerfeld <feld@feld.me>2019-07-01 01:08:07 +0000
commit85c7916c94017c6a3657a3540f1e6c3afcb78225 (patch)
tree3c4d4976b52a135f73e07b0fe68b17aae2681ee1 /priv/repo/migrations/20190408123347_create_conversations.exs
parent66380d36d540751f59445c8a65e9747ce5475ee5 (diff)
downloadpleroma-85c7916c94017c6a3657a3540f1e6c3afcb78225.tar.gz
pleroma-85c7916c94017c6a3657a3540f1e6c3afcb78225.zip
[#1033] Fix database migrations
Diffstat (limited to 'priv/repo/migrations/20190408123347_create_conversations.exs')
-rw-r--r--priv/repo/migrations/20190408123347_create_conversations.exs10
1 files changed, 5 insertions, 5 deletions
diff --git a/priv/repo/migrations/20190408123347_create_conversations.exs b/priv/repo/migrations/20190408123347_create_conversations.exs
index 0e0af30ae..7b7d89da7 100644
--- a/priv/repo/migrations/20190408123347_create_conversations.exs
+++ b/priv/repo/migrations/20190408123347_create_conversations.exs
@@ -6,12 +6,12 @@ defmodule Pleroma.Repo.Migrations.CreateConversations do
use Ecto.Migration
def change do
- create table(:conversations) do
+ create_if_not_exists table(:conversations) do
add(:ap_id, :string, null: false)
timestamps()
end
- create table(:conversation_participations) do
+ create_if_not_exists 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)
@@ -19,8 +19,8 @@ defmodule Pleroma.Repo.Migrations.CreateConversations do
timestamps()
end
- create index(:conversation_participations, [:conversation_id])
- create unique_index(:conversation_participations, [:user_id, :conversation_id])
- create unique_index(:conversations, [:ap_id])
+ create_if_not_exists index(:conversation_participations, [:conversation_id])
+ create_if_not_exists unique_index(:conversation_participations, [:user_id, :conversation_id])
+ create_if_not_exists unique_index(:conversations, [:ap_id])
end
end