0
0
NestJSframework~5 mins

Migrations in NestJS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a migration in the context of NestJS and databases?
A migration is a script that changes the database schema in a controlled way. It helps keep track of changes like creating or modifying tables, so the database structure matches the app's needs.
Click to reveal answer
beginner
Why should you use migrations instead of manually changing the database?
Migrations keep changes organized and repeatable. They let you update databases safely across different environments and help avoid mistakes or data loss.
Click to reveal answer
beginner
Which NestJS package is commonly used to handle migrations?
TypeORM is often used with NestJS for migrations. It provides commands to create, run, and revert migrations easily.
Click to reveal answer
intermediate
What command do you use to generate a new migration file with TypeORM CLI?
You use the command: typeorm migration:create -n MigrationName to create a new migration file with a given name.
Click to reveal answer
beginner
How do migrations help when working in a team?
Migrations let everyone apply the same database changes in the same order. This keeps the database consistent for all developers and avoids conflicts.
Click to reveal answer
What is the main purpose of a migration in NestJS projects?
ATo manage user authentication
BTo write frontend UI code
CTo deploy the app to a server
DTo update the database schema safely
Which tool is commonly used with NestJS for database migrations?
AReact
BTypeORM
CExpress
DWebpack
What does the command typeorm migration:run do?
ARuns all pending migrations to update the database
BCreates a new migration file
CDeletes the database
DStarts the NestJS server
Why is it important to commit migration files to version control?
ASo all team members can apply the same database changes
BTo speed up the app
CTo improve frontend styling
DTo reduce server costs
If you want to undo the last migration, which command would you use?
Atypeorm migration:run
Btypeorm migration:create
Ctypeorm migration:revert
Dnpm start
Explain what migrations are and why they are useful in NestJS projects.
Think about how you keep your database organized and consistent.
You got /4 concepts.
    Describe the typical workflow for creating and running migrations using TypeORM in NestJS.
    Consider the steps from writing to applying migrations.
    You got /4 concepts.