Giter VIP home page Giter VIP logo

Comments (9)

wtrocki avatar wtrocki commented on May 12, 2024 1

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.

wtrocki avatar wtrocki commented on May 12, 2024

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:

  1. Init project
  2. Run docker compose with db
  3. Generate resolvers
  4. Generate DB
  5. Run server manually

-- Now I want to edit something in graphql types.

  1. Generate resolvers again
  2. Drop database
  3. Apply database schema
  4. 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.

ankitjena avatar ankitjena commented on May 12, 2024

watch command would be real nice feature. @wtrocki What do you think about templates for now as I have mentioned above?

from graphback.

wtrocki avatar wtrocki commented on May 12, 2024

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.

ankitjena avatar ankitjena commented on May 12, 2024

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.

wtrocki avatar wtrocki commented on May 12, 2024

Agreed with everything. There is no need for follow up issue as we have all done

from graphback.

wtrocki avatar wtrocki commented on May 12, 2024

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.

wtrocki avatar wtrocki commented on May 12, 2024

Let's leave it open and provide more details once we finish spikes

from graphback.

wtrocki avatar wtrocki commented on May 12, 2024

Content here outdated and we have couple separate issues. Closing this one

from graphback.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.