mirror of
https://github.com/plausible/analytics.git
synced 2024-12-26 19:15:03 +03:00
23b9032148
* Allow site deletion with IP Rules stored * drop_if_exists
20 lines
511 B
Elixir
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
|