0
0
NextJSframework~5 mins

Database migrations in NextJS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a database migration in the context of Next.js applications?
A database migration is a way to change the database schema over time in a controlled and organized manner. It helps keep the database structure in sync with the application code.
Click to reveal answer
beginner
Why should you use migrations instead of manually changing the database?
Migrations ensure changes are repeatable, trackable, and reversible. They prevent errors from manual edits and help teams work together safely on database changes.
Click to reveal answer
beginner
Which tool is commonly used with Next.js for managing database migrations?
Prisma is a popular tool used with Next.js that provides an easy way to write and run database migrations using its schema and CLI commands.
Click to reveal answer
intermediate
What command do you run to create a new migration with Prisma in a Next.js project?
You run npx prisma migrate dev --name descriptive_migration_name to create and apply a new migration during development.
Click to reveal answer
intermediate
How do migrations help when deploying a Next.js app to production?
Migrations allow you to update the production database schema safely and consistently, ensuring the app and database stay compatible without losing data.
Click to reveal answer
What is the main purpose of a database migration?
ATo backup the database automatically
BTo speed up database queries
CTo change the database schema safely over time
DTo delete old data from the database
Which tool integrates well with Next.js for migrations?
AWebpack
BReact Router
CExpress
DPrisma
What does the command npx prisma migrate dev do?
ACreates and applies a new migration during development
BDeletes all migrations
CStarts the Next.js development server
DGenerates React components
Why is it important to track migrations in version control?
ATo avoid writing code
BTo share database changes with the team
CTo reduce server costs
DTo increase app speed
What happens if you run migrations on a production database?
AThe database schema updates safely to match the app
BThe app crashes immediately
CAll data is erased
DNothing happens
Explain what database migrations are and why they are important in Next.js projects.
Think about how your app's data structure changes over time.
You got /3 concepts.
    Describe the steps to create and apply a new migration using Prisma in a Next.js app.
    Focus on the Prisma CLI commands and schema updates.
    You got /4 concepts.