Skip to content

Foreign Key Constraint  #348

@elv1s

Description

@elv1s

Foreign Key Constraint in Postgres connector

Similar to the MySQL data connector, it would be great if the Postgres connector supported Foreign Key Constraints defined in LoopBack models. This would enforce referenced object to exist before adding relationship, and prevent deletion if the object is being referenced.

The foreignKeys would be the same top level property for models compatible with MySQL

{ "name": "Project", "relations": { "account": { "type": "belongsTo", "model": "Account", "foreignKey": "accountId", "primaryKey": "id" } }, "foreignKeys": { "accountId": { "name": "accountId", "foreignKey": "accountId", "entityKey": "id", "entity": "Account" } } }

Additional information

For related MySQL issue see: loopbackio/loopback-connector-mysql#294

Metadata

Metadata

Assignees

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