Improved the migration instructions

This commit is contained in:
Matt Aitken
2023-07-31 16:06:12 +01:00
committed by GitHub
parent 495acf4319
commit 10fef0f667
+9 -4
View File
@@ -97,22 +97,27 @@ webapp:dev: If you didn't try to log in, you can safely ignore this email.
## Adding and running migrations
1. Modify packages/database/prisma/schema.prisma file
2. cd into packages/database folder and run
2. Change directory to the packages/database folder
```sh
cd packages/database
```
4. Generate the Prisma client
```sh
pnpm run generate
```
The above updates the prisma client generated into node_modules/.prisma/client folder. This helps with typing of relevant prisma models. It ensures typescript
recognizes fields added or removed from a model and type-checks appropriately.
3. Generate and apply the migrations by running
5. Create and apply the migrations
```
pnpm run db:migrate:dev
```
This creates a migration file and executes the migrations against your database and applies changes to the database schema(s)
4. Commit generated migrations as well as changes to the schema.prisma file
6. Commit generated migrations as well as changes to the schema.prisma file
7. If you're using VSCode you may need to restart the Typescript server in the webapp to get updated type inference. Open a TypeScript file, then open the Command Palette (View > Command Palette) and run `TypeScript: Restart TS server`.
## Testing CLI changes
To test CLI changes, follow the steps below: