diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36acc9ef8c4..c19f4c57c8f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -95,6 +95,30 @@ webapp:dev: If you didn't try to log in, you can safely ignore this email. `` 4. Paste the magic link shown in your terminal into your browser to login. +## Adding and running migrations +1. Modify packages/database/prisma/schema.prisma file +2. Change directory to the packages/database folder + ```sh + cd packages/database + ``` +3. 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. + +4. 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) + +5. Commit generated migrations as well as changes to the schema.prisma file +6. 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: