Entity Framework Core Interview Question #79
What is the __EFMigrationsHistory table?
Migrations, Database Schema & Data Management Mid-Level Intermediate
Quick Interview Answer
The __EFMigrationsHistory table records which EF Core migrations have been applied to a database. EF Core uses it to determine which migrations are still pending.
Detailed Explanation
The __EFMigrationsHistory table records which EF Core migrations have been applied to a database. EF Core uses it to determine which migrations are still pending.
The table is created and maintained by the migrations infrastructure. It normally contains a migration identifier and EF Core product version information.
Deleting or manually changing migration-history rows without understanding the actual schema can make EF Core's migration state inconsistent with the database.
Code Example
SELECT *
FROM __EFMigrationsHistory
ORDER BY MigrationId;