Implement related events

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2019-04-11 18:25:32 +02:00
parent 20a4f7244c
commit a877e4d7d9
7 changed files with 181 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
defmodule Mobilizon.Repo.Migrations.EventEventTagOnDelete do
use Ecto.Migration
def up do
drop(constraint(:events_tags, "events_tags_event_id_fkey"))
drop(constraint(:events_tags, "events_tags_tag_id_fkey"))
alter table(:events_tags) do
modify(:event_id, references(:events, on_delete: :delete_all))
modify(:tag_id, references(:tags, on_delete: :delete_all))
end
end
def down do
drop(constraint(:events_tags, "events_tags_event_id_fkey"))
drop(constraint(:events_tags, "events_tags_tag_id_fkey"))
alter table(:events_tags) do
modify(:event_id, references(:events))
modify(:tag_id, references(:tags))
end
end
end