analytics/priv/repo/migrations/20240220144655_cascade_delete_ip_rules.exs
hq1 23b9032148
Allow site deletion with IP Rules stored (#3804)
* Allow site deletion with IP Rules stored

* drop_if_exists
2024-02-21 08:36:43 +01:00

20 lines
511 B
Elixir

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