NestJS - Database with TypeORMHow can you ensure a migration runs only once and does not reapply in NestJS with TypeORM?AYou need to rename migration classes after each runBTypeORM tracks applied migrations in a special table and skips duplicatesCNestJS automatically deletes migration files after runningDYou must manually comment out migration code after runningCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand migration trackingTypeORM stores applied migrations in a table to avoid reapplying them.Step 2: Eliminate manual or incorrect methodsManual commenting, deleting files, or renaming classes are not standard or safe practices.Final Answer:TypeORM tracks applied migrations in a special table and skips duplicates -> Option BQuick Check:Migration tracking table prevents reapplication [OK]Quick Trick: TypeORM uses a table to track applied migrations [OK]Common Mistakes:Thinking manual code changes prevent rerunsAssuming NestJS deletes migration files automaticallyBelieving renaming classes controls migration runs
Master "Database with TypeORM" in NestJS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More NestJS Quizzes Authentication - Protected routes with guards - Quiz 11easy Database with Prisma - Prisma Client usage - Quiz 14medium Database with Prisma - Prisma migrations - Quiz 14medium Database with TypeORM - Transactions - Quiz 3easy Database with TypeORM - Entity definition - Quiz 3easy Database with TypeORM - Entity definition - Quiz 14medium Interceptors - Response transformation - Quiz 5medium Pipes - Why pipes transform and validate input - Quiz 14medium Pipes - Pipe binding (parameter, method, controller, global) - Quiz 4medium Pipes - File validation pipe - Quiz 7medium