To regenerate the Prisma Client after making changes to your schema, run the following command:
pnpm exec prisma generateThis will regenerate the Prisma Client based on the current schema.
To apply migrations to your database, first make sure your Prisma schema is up to date with the changes you want. Then, run:
pnpm exec prisma migrate devThis will apply any pending migrations to your database and regenerate the Prisma Client.
To check the current state of your database schema in comparison to your Prisma schema, use:
pnpm exec prisma migrate statusIf you’ve made changes to your Prisma schema (e.g., added a new model or updated a field) and need to create a migration:
pnpm exec prisma migrate dev --name your-migration-nameReplace your-migration-name with a descriptive name for the migration (e.g., add-new-model).
If you want to reset your database (useful during development), you can run:
pnpm exec prisma migrate resetThis will drop and recreate your database, applying all migrations from scratch.
To inspect your schema in a human-readable format, run:
pnpm exec prisma studioThis will open Prisma Studio, which provides a GUI to view and interact with your database.
To regenerate the Prisma Client in a production environment, use:
pnpm exec prisma generate --productionThis ensures that Prisma Client is optimized for production environments.
To see more detailed logs while running Prisma commands, use:
DEBUG="*" pnpm exec prisma <command>For example:
DEBUG="*" pnpm exec prisma migrate devThis guide provides a quick overview of common Prisma commands to regenerate the client, apply migrations, and interact with your database.