Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2023-10-17 16:41:31 +02:00
parent 0613f7f736
commit b5672cee7e
108 changed files with 5221 additions and 1318 deletions

View File

@@ -0,0 +1,37 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddActorConversations do
use Ecto.Migration
def up do
create table(:conversations) do
add(:event_id, references(:events, on_delete: :delete_all), null: true)
add(:origin_comment_id, references(:comments, on_delete: :delete_all), null: false)
add(:last_comment_id, references(:comments, on_delete: :delete_all), null: false)
timestamps()
end
create table(:conversation_participants) do
add(:conversation_id, references(:conversations, on_delete: :delete_all), null: false)
add(:actor_id, references(:actors, on_delete: :delete_all), null: false)
add(:unread, :boolean, default_value: true)
timestamps()
end
alter table(:comments) do
add(:conversation_id, references(:conversations, on_delete: :delete_all), null: true)
end
end
def down do
drop table(:conversation_participants)
alter table(:comments) do
remove(:conversation_id)
end
drop table(:conversations)
end
end