generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Working with Flyway, Prisma, NestJS and GraphQL
afwilcox edited this page Feb 6, 2024
·
1 revision
See below for a common developer workflow for a schema first approach to adding new entities to the project:
-
Create DDL scripts that are stored in the migrations directory and run these scripts against your local database
-
Run the following command to sync the prisma schema with the database:
- npx prisma db pull
- Run the following command to generate the prisma client:
- npx prisma generate
- There is a bit of a weird bug with prisma / VS Code at this point... See: https://stackoverflow.com/questions/65663292/prisma-schema-not-updating-properly-after-adding-new-fields
- Restart VS Code or
- Restart CS Code language server or
- Open file node_modules/.prisma/client/index.d.ts
- Generate the required nestJS objects through the following command:
- npx nest g resource
- select 'GraphQL (schema first)'
- Optionally create CRUD entry points depending on what you are doing
- Make required changes to the generated entities. At a minimum you will need to:
- Add a graphQL schema file to define your queries and mutations
- Import the prisma module as the first argument to the new module and specs
- Add required functions to the resolver and service to implement the new functionality