Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loopback model definition is not adding foreign key relation in database table #3594

Closed
malek0512 opened this issue Aug 22, 2019 · 2 comments
Assignees

Comments

@malek0512
Copy link

Description/Steps to reproduce

It seems loopback is not adding foreign key constraint in Database table as per model definition.
I am using loopback 4 for API design and data modeling.
I am using DB2 as my database.

Expected result

Foreign key constraints defined in loopback 4 model, should be reflected during table creation.

@dhmlau dhmlau transferred this issue from loopbackio/loopback-connector-dashdb Aug 23, 2019
@dhmlau
Copy link
Member

dhmlau commented Aug 23, 2019

@malek0512, currently the FK constraints are not being added during table creation. We have the strong relation epic covering this, and the proposal to implement it: #2712.

For now, you might want to add the foreign key constraints in the model decorator. See example: https://github.com/dhmlau/loopback4-coffeeshop/blob/master/src/models/review.model.ts#L4-L15. Hope it helps.

@dhmlau dhmlau self-assigned this Aug 23, 2019
@dhmlau
Copy link
Member

dhmlau commented Nov 28, 2019

Closing as duplicate of #2332.
@malek0512, please feel free to continue the discussion over that github issue. Thanks.

@dhmlau dhmlau closed this as completed Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants