What are Migrations in EF Core?

Updated Apr 28, 2026

Short answer

Migrations provide a way to incrementally update the database schema to keep it in sync with the application's data model.

Deep explanation

When you modify C# entity classes, you create a migration (Add-Migration). EF Core generates a C# file with Up() and Down() methods containing instructions to alter the DB schema. You then apply it using Update-Database.

Real-world example

Adding a 'DateOfBirth' property to a User class and using migrations to safely add the new column to the production database.

Common mistakes

  • Manually altering the database schema without using migrations, causing the __EFMigrationsHistory table to fall out of sync.

Follow-up questions

  • What is the __EFMigrationsHistory table?

More Entity Framework interview questions

View all →