0
0
NestJSframework~5 mins

Prisma migrations in NestJS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of Prisma migrations in a NestJS project?
Prisma migrations help manage and apply changes to the database schema in a safe and organized way. They keep the database structure in sync with your Prisma schema file.
Click to reveal answer
beginner
Which command creates a new migration file after updating the Prisma schema?
The command npx prisma migrate dev --name your_migration_name creates a new migration file and applies it to the database during development.
Click to reveal answer
intermediate
How does Prisma ensure migrations are applied in the correct order?
Prisma stores migration history in a special table in the database. It applies migrations sequentially based on this history to keep the database consistent.
Click to reveal answer
intermediate
What should you do before running migrations in a production environment?
You should review migration files carefully, back up your database, and run npx prisma migrate deploy to apply migrations safely without prompts.
Click to reveal answer
beginner
Why is it important to commit migration files to version control?
Committing migration files lets your team share database changes and ensures everyone applies the same schema updates, avoiding conflicts and errors.
Click to reveal answer
Which Prisma command applies migrations during development and updates the database?
Anpx prisma generate
Bnpx prisma migrate dev --name migration_name
Cnpx prisma studio
Dnpx prisma migrate deploy
Where does Prisma store the migration history to track applied migrations?
AIn a special table inside the database
BIn the Prisma schema file
CIn a JSON file in the project root
DIn environment variables
What is the recommended command to apply migrations in a production environment?
Anpx prisma migrate reset
Bnpx prisma migrate dev
Cnpx prisma migrate deploy
Dnpx prisma generate
Why should migration files be committed to version control?
ATo share schema changes with the team
BTo speed up the application runtime
CTo store database credentials
DTo generate Prisma client
What happens if you change the Prisma schema but do not create a migration?
AThe Prisma client will update automatically
BThe database will reset
CThe migration will be created automatically on app start
DThe database schema will not update
Explain the steps to create and apply a new Prisma migration in a NestJS project.
Think about how you change the schema and then update the database safely.
You got /5 concepts.
    Describe how Prisma migrations help keep your database consistent across different environments.
    Consider how migrations track and share changes to avoid conflicts.
    You got /5 concepts.