loopback-next
loopback-next copied to clipboard
Add --tables/--models arguments to `lb4 discover` command
Suggestion
Add arguments --tables or --models to lb4 discover command.
Use Cases
I'm a new user to Loopback trying to create a REST API for two large existing SQL Server databases, each database has in excess of 200 tables spanning 8+ schemas, and scrolling the list in the interactive prompts to find just the 8 tables required is near impossible, and made worse by the fact that the results don't seem to be in any particular order...?

This would also allow you to selectively discover models later in development much easier.
Examples
lb4 discover --tables=customers,contacts,quotes,parts
lb4 discover --models=customers,contacts,quotes,parts
@dhmlau I don't permissions to shift this issue to the LoopBack 4 repo. Could you please assist? Thanks
Transferred!
It would be a useful feature. For database migration, we can list which models to migrate, but not for discovery.
Any other way of doing this in the meantime? I have 2500 tables, impossible to navigate with CLI.
Made a PR: https://github.com/strongloop/loopback-next/pull/7609
WORKAROUND:
lb4 discover --all --outDir=src/models/all
Generates all models. Then you can easily pick the right ones and remove the others.
lb4 discover --model is available now. Have a look at the PR. Closing the issue.