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

What's the suggested way for a existing SeaORM user to adopt seaography? #27

Closed
Tracked by #34
billy1624 opened this issue Aug 4, 2022 · 6 comments
Closed
Tracked by #34

Comments

@billy1624
Copy link
Member

Currently, I see the seaography assume there exists a schema reside in one of the supported database engine. Then, SeaORM entities and async-graphql types will be generated by seaography.

But what if a existing SeaORM user wish to introduce async-graphql support into their existing codebase? What's the suggested way of doing it? Should we provide a way to generate async-graphql types only? Instead of only provide a CLI that generate both at the same time?

@karatakis
Copy link
Collaborator

That's a great question.

A proposed way is to allow cli to accept a parameter that points to sea orm entities folder, and when it is used we skip generating sea orm and do the following:

  1. parse the sea orm entities folder
  2. populate seaography schema
  3. generate graphql entities

What's your thougs on that approach ?

@tyt2y3
Copy link
Member

tyt2y3 commented Aug 5, 2022

I think that's what we have talked about before comes to place. We have to break down the code generator into different stages, where stage 1 is schema discovery and stage 2 is code generation.

Actually, what does the stage 2 takes as input? If that's a SeaQuery schema representation, then it should be possible for sea-orm-cli to produce that and invoke the seaography library.

That say, most of the integration should be done inside sea-orm-cli

@karatakis karatakis mentioned this issue Aug 8, 2022
17 tasks
@billy1624
Copy link
Member Author

Actually, what does the stage 2 takes as input? If that's a SeaQuery schema representation, then it should be possible for sea-orm-cli to produce that and invoke the seaography library.

Stage 2 takes SeaQuery table create statement.

Are you suggesting we simply skip generating SeaORM entities and generate graphql entities only?

For example, assumed we have a entity crate in a cargo workspace which contains all the SeaORM entities. Then, we generate two more crates to provide async-graphql supports:

  • graphql crate: contains all graphql entities, depends on async-graphql and entity crate
  • graphql-api crate: home of web API code, depends on async-graphql-<WEB_API> and entity crate

@tyt2y3
Copy link
Member

tyt2y3 commented Aug 11, 2022

Sounds like a workable plan

@billy1624
Copy link
Member Author

Thoughts? @karatakis

@karatakis
Copy link
Collaborator

@billy1624 with #114 we have completely isolated seaography from sea-orm entity generation. If you provide the seaography CLI with the folder of SeaORM entities it generates the GraphQL API without the need of modifications.

@github-project-automation github-project-automation bot moved this from Triage to Done in SeaQL Dev Tracker Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

3 participants