add constraints for member-user and member-property

This commit is contained in:
Moritz 2025-10-16 15:12:30 +02:00
parent 59a8067c09
commit 7c1aeddad4
Signed by: moritz
GPG key ID: 1020A035E5DD0824
6 changed files with 537 additions and 0 deletions

View file

@ -42,4 +42,10 @@ defmodule Mv.Membership.Property do
calculations do
calculate :value_to_string, :string, expr(value[:value] <> "")
end
# Ensure a member can only have one property per property type
# For example: A member can have only one "email" property, one "phone" property, etc.
identities do
identity :unique_property_per_member, [:member_id, :property_type_id]
end
end