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

CLI for model discovery in LB4 #1949

Closed
1 task
dhmlau opened this issue Oct 31, 2018 · 8 comments
Closed
1 task

CLI for model discovery in LB4 #1949

dhmlau opened this issue Oct 31, 2018 · 8 comments

Comments

@dhmlau
Copy link
Member

dhmlau commented Oct 31, 2018

Description / Steps to reproduce / Feature proposal

If I have a sql datatabase (say mysql), how can i create model based on the schema in the database?

Related to: #1921

Updates

Per our team meeting, @raymondfeng is suggesting to implement lb4 discover instead of document the current way for model discovery because not all the generated model json from the discoverSchemas method can be represented correctly in LB4 model (it works for the simple cases, but may not be for other).

There will be 2 stages in lb4 discover:

  1. Getting the model JSON from database
    • after creating the datasource, users can simply run this discover command to get the model json.
    • at the same time, model.json created in LB3 can be reused in this case
  2. Using the model.json to generate model.ts

@strongloop/loopback-maintainers, thoughts?


Original Description

Acceptance Criteria

  • Document the instruction in how to useDataSource.discoverSchemas to create model.
    • Possibly create a page under How tos in documentation

References

I've captured some steps in how to use model discovery and Mario added his comments in the following links:
strongloop/v4.loopback.io#50 (comment)
strongloop/v4.loopback.io#50 (comment)

@dhmlau dhmlau changed the title [Docs] Document how to do model discovery in LB4 [CLI] CLI for model discovery in LB4 Nov 15, 2018
@dhmlau dhmlau added the CLI label Nov 15, 2018
@jannyHou
Copy link
Contributor

@dhmlau I am good with Raymond's suggestion. I've heard of lots of expectations for this feature from LB3 users.

Acceptance Criteria would be:

  • Getting the model JSON from database by calling DataSource.discoverSchemas

    • after creating the datasource, users can simply run this discover command to get the model json.
    • at the same time, model.json created in LB3 can be reused in this case
  • Using the model.json to generate model.ts

@jannyHou
Copy link
Contributor

Hmm I think this is a dup story of #1921

And a community member is already implementing the cli in a forked repo.

@dhmlau
Copy link
Member Author

dhmlau commented Dec 13, 2018

@jannyHou , if it's a duplicate, I'm good to close this issue and continue the discussion over #1921.

@dhmlau dhmlau closed this as completed Dec 13, 2018
@bajtos
Copy link
Member

bajtos commented Dec 13, 2018

@jannyHou @dhmlau Since you closed this issue as a duplicate of #1921, could you please update labels on #1921 to include labels from this issue?

As I see it, this issue was about improving our CLI, while #1921 was more about documenting how to use existing APIs.

@bajtos
Copy link
Member

bajtos commented Dec 13, 2018

Do we also need to update our issue keeping track of feature parity with LB3? #1949 Are there any other issues and Epics to update?

@bajtos
Copy link
Member

bajtos commented Feb 4, 2019

AFAICT, there is no CLI command for discovering database schemas and creating model definitions from them. I am reopening this issue.

@bajtos bajtos reopened this Feb 4, 2019
@bajtos bajtos changed the title [CLI] CLI for model discovery in LB4 CLI for model discovery in LB4 Feb 4, 2019
@bajtos bajtos added the feature label Feb 4, 2019
@dhmlau
Copy link
Member Author

dhmlau commented Feb 7, 2019

@bajtos, is this PR #2245 fixes this issue?

@dhmlau
Copy link
Member Author

dhmlau commented Apr 11, 2019

Closing as done as PR #2245 has landed.

@dhmlau dhmlau closed this as completed Apr 11, 2019
@dhmlau dhmlau added this to the April 2019 milestone milestone Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants