prisma migrate dev in a NestJS project?You run prisma migrate dev in your NestJS project. What is the immediate effect on your database and Prisma client?
Think about what prisma migrate dev does during development to keep your database and client in sync.
The prisma migrate dev command creates a new migration file based on your Prisma schema changes, applies it to your database, and regenerates the Prisma client so your code can use the updated schema.
You want to add a new model Post with an id as primary key and a title field. Which schema snippet is correct for Prisma migrations?
Look for the correct Prisma attributes for primary key and auto-increment.
Prisma uses @id to mark the primary key and @default(autoincrement()) to auto-increment integer IDs. Option A uses the correct syntax.
prisma migrate deploy fail with 'Migration not found' error?You deployed your NestJS app and ran prisma migrate deploy on production, but it fails with 'Migration not found' error. What is the most likely cause?
Consider what prisma migrate deploy expects to find on the server.
prisma migrate deploy applies existing migration files to the database. If the migration files are missing or not copied to production, it cannot find them and throws this error.
prisma migrate reset?You run prisma migrate reset in your NestJS project. What happens to your database?
Think about what 'reset' means for a database in development.
prisma migrate reset drops the database, recreates it, applies all migrations from scratch, and regenerates the Prisma client. This clears all data and schema changes.
prisma migrate dev directly on production?In a NestJS project, why is it recommended to use prisma migrate deploy instead of prisma migrate dev on production environments?
Consider the differences in behavior and safety between development and production migration commands.
prisma migrate dev is designed for development. It can create new migration files and interactively prompt users, which can cause issues in automated production environments. prisma migrate deploy safely applies existing migrations without prompts.