agents/rules/data-prisma-migrations.md
After making changes to the Prisma schema in Cal.com and creating migrations, you need to run:
yarn prisma generate
This updates the TypeScript types. This is especially important:
# Development migration
npx prisma migrate dev --name migration_name
# Production deployment
yarn workspace @calcom/prisma db-deploy
When adding timestamp fields like createdAt and updatedAt:
updatedAt fields, ensure they're updated when records are modifiedWhenever you change the schema.prisma file, remember to always consolidate migrations by squashing them as declared in the Prisma docs.
This helps maintain a clean migration history and prevents accumulation of multiple migration files.
If you encounter enum generator errors during the Prisma generate step (like "Cannot find module './enum-generator.ts'"), run yarn install first before trying to generate.
When implementing cache-related features that require timestamp tracking, always update the database schema first before modifying application code that references those fields.