What are migrations?
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 β Migrations
Interview Questions