Open fpoms opened 10 years ago
The disjoint constraint assumes that the name of the column is the name of the field. However, for the part association, the field name is appended with "_id" to create the field name.
Example:
(model/create :model {:name "Citizen" :fields [{:name "Motherland" :type "part" :target-id (caribou.model/models :nation :id) :reciprocal-name "Citizens" :disjoint true}]})
Bad sql:
DEBUG :db alter table citizen add constraint citizen_motherland_unique unique (motherland)
Proper sql:
DEBUG :db alter table citizen add constraint citizen_motherland_unique unique (motherland_id)
The disjoint constraint assumes that the name of the column is the name of the field. However, for the part association, the field name is appended with "_id" to create the field name.
Example:
Bad sql:
Proper sql: