Allow site deletion with IP Rules stored (#3804)

* Allow site deletion with IP Rules stored

* drop_if_exists
This commit is contained in:
hq1 2024-02-21 08:36:43 +01:00 committed by GitHub
parent 5cdca6f408
commit 23b9032148
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,19 @@
defmodule Plausible.Repo.Migrations.CascadeDeleteIpRules do
use Ecto.Migration
def up do
drop_if_exists constraint(:shield_rules_ip, "shield_rules_ip_site_id_fkey")
alter table(:shield_rules_ip) do
modify :site_id, references(:sites, on_delete: :delete_all), null: false
end
end
def down do
drop_if_exists constraint(:shield_rules_ip, "shield_rules_ip_site_id_fkey")
alter table(:shield_rules_ip) do
modify :site_id, references(:sites), null: false
end
end
end