Open thiscode opened 5 days ago
Here is some more detail after I looked into it more closely: Loopback uses @loopback/repository
^7.0.8
as a dependency in the latest version. @loopback/repository
in turn uses loopback-datasource-juggler
^5.1.2
as a dependency. However, loopback-datasource-juggler
has been broken since ^5.1.0
. A workaround is to downgrade the loopback application in the following order:
npm i @loopback/repository@7.0.7 --save-exact
npm i loopback-datasource-juggler@5.0.12 --save-exact
After that downgrade the discoverSchema
works again.
The cli tool lb4 discover --relations=true
will show a warning:
The project was originally generated by @loopback/cli@6.1.2.
The following dependencies are incompatible with @loopback/cli@6.1.2:
dependencies
- @loopback/repository: 7.0.7 (cli ^7.0.8)
But choosing Skip upgrading project dependencies
it will continue and the relations will be discovered correctly.
@aaqilniz, could you please take a look? Thanks.
The function
discoverSchemas
no longer discover any relations since the commitb4295fdf9786770bee89001685a1a568c1718504
.https://github.com/loopbackio/loopback-datasource-juggler/commit/b4295fdf9786770bee89001685a1a568c1718504
Before the commit, the array
results
had a maximum of 3 elements. Thus, the relations were correctly read from position[2]
:However, after the commit, the unique keys are in this position. The index position was forgotten to be adjusted further down:
Steps to reproduce
The loopback cli tool
discover
will not create model with relations when used with the option--relations=true
and the connectorloopback-connector-mysql
.Current Behavior
The loopback cli tool
discover
will not create model with relations when used with the option--relations=true
and the connectorloopback-connector-mysql
.Expected Behavior
The loopback cli tool
discover
should create model with relations when used with the option--relations=true
and the connectorloopback-connector-mysql
.Link to reproduction sandbox
Additional information
Related Issues
See Reporting Issues for more tips on writing good issues