📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

How would you test EF Core migrations before they reach production so that data problems and long locks are caught early?

Senior RealWorldScenario Advanced

🎯 Key points

  • Apply migrations against real SQL Server in CI (Testcontainers)
  • Test upgrade from the previous release schema, not only from empty
  • Rehearse on a restored, masked production copy
  • Time migrations and watch blocking
  • Gate on destructive operations in the script
  • Check has-pending-model-changes in CI

⏱ 30-second answer

Apply every migration in CI against a real SQL Server (a Testcontainers container, not the in-memory provider), from an empty database and from the previous release's schema. Then rehearse it in pre-production against a restored, masked copy of production to catch real data problems (duplicates, NULLs, oversized strings) and to time it. Add a CI gate that scans the idempotent script for destructive operations, and a test that dotnet ef migrations has-pending-model-changes returns nothing.

🔍 What the interviewer is checking

Checks rehearsal against realistic data and CI gates

↩ Usually asked after

More in Production EF

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me