Bird
0
0

A migration runs but does not apply changes to the database. What is a common mistake causing this?

medium📝 Debug Q7 of 15
NestJS - Database with TypeORM
A migration runs but does not apply changes to the database. What is a common mistake causing this?
AUsing async functions for migration methods
BDefining both up() and down() methods
CNaming the migration class incorrectly
DNot calling the queryRunner.query() inside up()
Step-by-Step Solution
Solution:
  1. Step 1: Identify why migration has no effect

    If queryRunner.query() is not called, no SQL commands run to change the database.
  2. Step 2: Understand method roles

    up() must execute queries to apply schema changes.
  3. Final Answer:

    Not calling the queryRunner.query() inside up() -> Option D
  4. Quick Check:

    Missing queryRunner.query() = no DB changes [OK]
Quick Trick: Always run queries inside up() to apply changes [OK]
Common Mistakes:
  • Thinking async functions cause no effect
  • Believing down() method affects applying changes
  • Assuming class name affects migration execution

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More NestJS Quizzes