mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-22 07:52:43 +00:00
Merge branch 'bug/delete-actors-cascade-followers' into 'master'
Make actors deletion cascade to followers Closes #253 See merge request framasoft/mobilizon!294
This commit is contained in:
commit
7b6d9f73d3
1 changed files with 23 additions and 0 deletions
|
@ -0,0 +1,23 @@
|
|||
defmodule Mobilizon.Storage.Repo.Migrations.DeleteActorsCascadeToFollowers do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
drop(constraint(:followers, "followers_actor_id_fkey"))
|
||||
drop(constraint(:followers, "followers_target_actor_id_fkey"))
|
||||
|
||||
alter table(:followers) do
|
||||
modify(:actor_id, references(:actors, on_delete: :delete_all))
|
||||
modify(:target_actor_id, references(:actors, on_delete: :delete_all))
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
drop(constraint(:followers, "followers_actor_id_fkey"))
|
||||
drop(constraint(:followers, "followers_target_actor_id_fkey"))
|
||||
|
||||
alter table(:followers) do
|
||||
modify(:actor_id, references(:actors, on_delete: :nothing))
|
||||
modify(:target_actor_id, references(:actors, on_delete: :nothing))
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue