fix member deletion: property delete on cascade

This commit is contained in:
Moritz 2025-06-17 15:28:52 +02:00
parent dab54bcef9
commit 6f88a635cc
Signed by: moritz
GPG key ID: 1020A035E5DD0824
4 changed files with 154 additions and 2 deletions

View file

@ -0,0 +1,38 @@
defmodule Mv.Repo.Migrations.MemberDelete do
@moduledoc """
Updates resources based on their most recent snapshots.
This file was autogenerated with `mix ash_postgres.generate_migrations`
"""
use Ecto.Migration
def up do
drop constraint(:properties, "properties_member_id_fkey")
alter table(:properties) do
modify :member_id,
references(:members,
column: :id,
name: "properties_member_id_fkey",
type: :uuid,
prefix: "public",
on_delete: :delete_all
)
end
end
def down do
drop constraint(:properties, "properties_member_id_fkey")
alter table(:properties) do
modify :member_id,
references(:members,
column: :id,
name: "properties_member_id_fkey",
type: :uuid,
prefix: "public"
)
end
end
end