Skip to content

Memory connector should enforce referential integrity #2333

@bajtos

Description

@bajtos

The memory connector should enforce foreign key and uniqueness constraints for HasMany, HasOne and BelongsTo relations.

For example, when creating an order using /post/{userId}/orders for a userId which is not that of a user, I would've expected some sort of a check that would've ensure that the userId exists. The connector should throw an error for an userId not in the database.

See #1718 for background and #2332 for the SQL story.

See https://github.com/strongloop/loopback-connector-rest/issues/134 for a Connector helper to parse different styles of index/fk definitions into a format that's easy to consume by connectors.

Acceptance criteria

Out of scope

  • "Plain" indexes without uniqueness check
  • onUpdate and onDelete options for foreign keys

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions