mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 00:26:30 +00:00
migration: add on_delete: :delete_all to hashtags object_id fk
This commit is contained in:
parent
745375bdcf
commit
22b2451edd
1 changed files with 19 additions and 0 deletions
|
@ -0,0 +1,19 @@
|
||||||
|
defmodule Pleroma.Repo.Migrations.DeleteHashtagsObjectsCascade do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def up do
|
||||||
|
execute("ALTER TABLE hashtags_objects DROP CONSTRAINT hashtags_objects_object_id_fkey")
|
||||||
|
|
||||||
|
alter table(:hashtags_objects) do
|
||||||
|
modify(:object_id, references(:objects, on_delete: :delete_all))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down do
|
||||||
|
execute("ALTER TABLE hashtags_objects DROP CONSTRAINT hashtags_objects_object_id_fkey")
|
||||||
|
|
||||||
|
alter table(:hashtags_objects) do
|
||||||
|
modify(:object_id, references(:objects, on_delete: :nothing))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue