loopback-next icon indicating copy to clipboard operation
loopback-next copied to clipboard

Add --tables/--models arguments to `lb4 discover` command

Open rigibore-charlie opened this issue 4 years ago • 5 comments

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...?

image

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

rigibore-charlie avatar Feb 10 '21 12:02 rigibore-charlie

@dhmlau I don't permissions to shift this issue to the LoopBack 4 repo. Could you please assist? Thanks

achrinza avatar Feb 18 '21 11:02 achrinza

Transferred!

dhmlau avatar Feb 18 '21 21:02 dhmlau

It would be a useful feature. For database migration, we can list which models to migrate, but not for discovery.

dhmlau avatar Feb 18 '21 21:02 dhmlau

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

igbenic avatar Jul 08 '21 09:07 igbenic

WORKAROUND:

lb4 discover --all --outDir=src/models/all

Generates all models. Then you can easily pick the right ones and remove the others.

prespic avatar Nov 10 '21 17:11 prespic

lb4 discover --model is available now. Have a look at the PR. Closing the issue.

aaqilniz avatar May 18 '23 13:05 aaqilniz