mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-25 01:12:30 +00:00
dc07f34d78
Also add tomstones Signed-off-by: Thomas Citharel <tcit@tcit.fr>
23 lines
815 B
Elixir
23 lines
815 B
Elixir
defmodule Mobilizon.Storage.Repo.Migrations.CascadeCommentDeletion do
|
|
use Ecto.Migration
|
|
|
|
def up do
|
|
drop(constraint(:comments, "comments_in_reply_to_comment_id_fkey"))
|
|
drop(constraint(:comments, "comments_origin_comment_id_fkey"))
|
|
|
|
alter table(:comments) do
|
|
modify(:in_reply_to_comment_id, references(:comments, on_delete: :nilify_all))
|
|
modify(:origin_comment_id, references(:comments, on_delete: :nilify_all))
|
|
end
|
|
end
|
|
|
|
def down do
|
|
drop(constraint(:comments, "comments_in_reply_to_comment_id_fkey"))
|
|
drop(constraint(:comments, "comments_origin_comment_id_fkey"))
|
|
|
|
alter table(:comments) do
|
|
modify(:in_reply_to_comment_id, references(:comments, on_delete: :nothing))
|
|
modify(:origin_comment_id, references(:comments, on_delete: :nothing))
|
|
end
|
|
end
|
|
end
|