What are migrations?
Short answer: How are they used in Code First? Migrations in EF Core are a way to: Track schema changes over time Apply those changes to the database π¦ Basic commands: Add-Migration MigrationName Update-Database Remove-Migration Script-Migration π Migrations are classes containing Up() and Down() methods (for applying and reverting changes). π They are essential for schema versioning in Code First. Entity Framework Core ββ¦
Real-world example (ShopNest)
When ShopNest adds a DiscountCode column, you create a migration, review the SQL, then apply it on staging before production.
Say this in the interview
- Define β one clear sentence (the short answer above).
- Example β relate it to a project like ShopNest or your real work.
- Trade-off β when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png