Skip to content

Disjoint constraint on part association results in invalid sql statement #38

@fpoms

Description

@fpoms

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions