I have changed my schema from
createdAt
formConfig
formTitle
id
To:
id
createdAt
title
imageUrl
lastOpenedDate
JSONConfig
However, after regenerating types and migration, the changes are not done in the web and API folder
I have checked prisma studio and the schema is updated their
I have already used commands
yarn rw g types
yarn rw prisma migrate dev
yarn rw-gen
yarn rw g sdl
I have even tried deleting GQL files and regenerating them, still getting same old schema
Running
yarn rw g sdl [SchemaName] -f
yarn rw generate scaffold [SchemaName] -f
Fixes the problem. Since it can overwrite files, Is this the correct way?
Hi @Mark0047 welcome to the community!
I think you have it correct! Let me walk you through the steps just to make sure we’re on the same page.
-
Make a change (or add) to a model in
prisma.schema
: you must apply these schema changes to your Database via yarn rw prisma migrate dev
-
Query the DB model via the GraphQL API: You need to create (or update) an SDL file and a Service file (both in the API). You can do this manually. But one way to do this is via the CLI generator. For just the SDL use
yarn rw generate sdl <model>
. See doc here.
-
Fetch data via the GraphQL API using a Web Cell component: You need to create (or update) a Cell component, both the
gql
query and the props. You can do this manually or use yarn redwood generate cell <name>
. See doc here.
If you want to do steps 2 and 3 at the same time, use yarn redwood generate scaffold <model>
. See doc here.