Remove events when deleting organizer

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-08-28 11:28:02 +02:00
parent 0e0b68445b
commit 050d5778dc
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -0,0 +1,19 @@
defmodule Mobilizon.Repo.Migrations.RemoveEventsWhenDeletingOrganizer do
use Ecto.Migration
def up do
drop(constraint(:events, "events_organizer_account_id_fkey"))
alter table(:events) do
modify(:organizer_actor_id, references(:actors, on_delete: :delete_all))
end
end
def down do
drop(constraint(:events, "events_organizer_actor_id_fkey"))
alter table(:events) do
modify(:organizer_actor_id, references(:actors, on_delete: :nothing))
end
end
end