member and properties
This commit is contained in:
parent
5ce9694d2f
commit
d01ae6af96
10 changed files with 455 additions and 1 deletions
|
|
@ -9,3 +9,31 @@
|
|||
#
|
||||
# We recommend using the bang functions (`insert!`, `update!`
|
||||
# and so on) as they will fail if something goes wrong.
|
||||
|
||||
alias Mv.Membership
|
||||
|
||||
for attrs <- [
|
||||
%{
|
||||
name: "Vorname",
|
||||
type: "string",
|
||||
description: "Vorname des Mitglieds",
|
||||
immutable: true,
|
||||
required: true
|
||||
},
|
||||
%{
|
||||
name: "Email",
|
||||
type: "string",
|
||||
description: "Email-Adresse des Mitglieds",
|
||||
immutable: true,
|
||||
required: true
|
||||
}
|
||||
] do
|
||||
# upsert?: true sorgt dafür, dass bei bestehendem Namen kein Fehler,
|
||||
# sondern ein Update (hier effektiv No-Op) ausgeführt wird
|
||||
{:ok, _} =
|
||||
Membership.create_property_type(
|
||||
attrs,
|
||||
upsert?: true,
|
||||
upsert_identity: :unique_name
|
||||
)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue