Database Migration Skill
When the user asks you to update the database schema, follow this procedure exactly:
- Modify the Schema File: Open
schema.prisma(or the equivalent ORM file) and add the new models or columns. - Generate the Migration: Run
npx prisma migrate dev --name <descriptive_name> --create-only. Do not apply the migration automatically. - Review Migration Script: Read the generated SQL file to ensure it doesn't accidentally drop existing columns containing data.
- Test Run: Run
npx prisma migrate devto apply locally. - Update Types: Ensure any frontend/backend type definitions that rely on this schema are regenerated (
npx prisma generate).