Comments (9)
Really good discussion here. We need to get back to the updated idea of how database changes can be handled. Without bringing the tooling that can be used I think we need to think if we can
build state aware generation process.
Our project would have this state from previous generation, this will allow us to calculate diff and then see diff on the database to deliver sql statements. If we do that separately we can benefit from large set of the open source libraries that do database management right.
So TL:DR idea is to detach database management problem from graphql problem by collecting
schema changes and feeding them back to SQL Diff engine that can both apply changes directly or make migration scripts
from graphback.
Worth adding that template has generated folder that is dynamic:
Example:
|-----generated
|-----schema.graphql
|-----resolvers.ts
|-----model
|-----<your-model-name>.graphql
|-----src
|-----config
|-----config.ts
|-----db.ts
|-----index.ts
|-----mapping.ts
|-----package.json
|-----Dockerfile
|-----docker-compose.yml
|-----package-lock.json
|-----tslint.json
|-----README.md
Once the project is initialized users can possibly tweak all apart from the generated folder. We would really lose control over the rest of the stack and this can evolve towards production. Initial deployment to production can really base off development ddl model so migrate command is not essential to deliver complete workflow. Development, in this case, can be a wider term, but this is really about the fact that for localhost or any remote cluster desired we will automatically adjust database structure to work with the current schema/resolvers.
Couple questions based on the model:
-
Where and how do you see the actual database running? Do we ignore that and assume that users will run docker-compose manually?
-
How about the fact that we need to run this server after generation. How do you see people doing actual development?
With the latest release this will look like this:
- Init project
- Run docker compose with db
- Generate resolvers
- Generate DB
- Run server manually
-- Now I want to edit something in graphql types.
- Generate resolvers again
- Drop database
- Apply database schema
- Start server again
It will be cool to have watch
command that will look for modifications in types and perform steps from 3 to 9 automatically
from graphback.
watch
command would be real nice feature. @wtrocki What do you think about templates for now as I have mentioned above?
from graphback.
Can you explain how you would see this working. Is all code editable or we will have runtime library that will setup db and it could be installed into vanilla templates?
It will probably require separate section to get into the idea. Whatever we go with there could be some side impacts and complexity related with aproach. We probably looking for something that is pluggable and also simple on its own
from graphback.
My approach would be to separate db specific templates and have a attribute that helps us choose config and docker-compose automatically for the template. If a user chooses a postgres template then we will inject postgres config and accordingly for different databases. The user can further edit these files according to usecases.
I added default configs in #56 , this will be modified going ahead when we add other templates and would be pluggable.
from graphback.
Agreed with everything. There is no need for follow up issue as we have all done
from graphback.
I think it will be worth to investigate prisma2 for this task to see how we can avoid writing this complex subsystem and do database migrations.
from graphback.
Let's leave it open and provide more details once we finish spikes
from graphback.
Content here outdated and we have couple separate issues. Closing this one
from graphback.
Related Issues (20)
- Headstart HOT 3
- Create Nest.js template HOT 22
- Project created by template contain invalid types - apollo-fullstack-react-mongo-ts HOT 4
- 'apollo-fullstack-react-mongo-ts' template breaks when a Comment is created HOT 3
- apollo-fullstack-react-postgres-ts template project error HOT 12
- Wrapping Resolver w/ Graphback? HOT 9
- Subscriptions not working in kafka template HOT 1
- When creating a new project with the command create-graphback it errors out HOT 2
- How to set on delete cascade in .graphql file HOT 3
- Preventing Leaking Through-Table Implementations
- Orderby Multiple Fields
- Codegen - TypeError: loader.loaderId is not a function HOT 3
- What does the release process look like? HOT 5
- Custom resolver "create" method types HOT 3
- buildGraphbackAPI errors with custom directives HOT 1
- Dependency Dashboard
- Schema generation error managing object's arrays. HOT 1
- Fragment generation produces invalid output on fields with parameters
- Current state of the project + compatibility with Vulcan
- Error when generating graphql files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphback.