Skip to content

Improve the way we specify/typecheck N:N relations #35

@rsslldnphy

Description

@rsslldnphy

Currently it's possible to define an N:N relation without defining the 1:N and N:1 relations between its two halves and the join table - but if you do so, you'll get a runtime error saying that both sides must be defined.

Technically we have enough info in just the N:N declaration to not need this, but it would make the code much more complicated (I think!) to do so. It's much easier relying on the existence of the other relations so we can reuse the code for fetching them.

However this isn't a great experience and so it would be good to improve it. Either by:

a) removing the requirement for both sides of the N:N relation to be defined
b) typechecking at some point to ensure they're both defined (this would likely have to happen at the point of call of the orm function, as we wouldn't have the info we need at the point the relations are initially defined)

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