Understanding the Migrations History Table for EF 6.0
- Last Updated: April 16, 2026
- 1 minute read
- ADO.NET
- Documentation
Migrations history table is a table used by Code First Migrations to store details about migrations applied to the database. By default the name of the table in the database is __MigrationHistory and it is created when applying the first migration do the database.
You can customize the table for the following things:
- Change names and/or facets of the columns to enable a 3rd party Migrations provider
- Change the name of the table
- Use a non-default schema for the _MigrationHistory table
- Store additional data for a given version of the context and therefore you need to add an additional column to the table
Customizing the Migrations History Table
Follow the given steps below to customize the Migrations History table:
- Make the changes that you want to in a class derived from HistoryContext. Changes that you can change include overriding the OnModelCreating method, and using fluent API to configure the Migrations History table.
- Once your custom HistoryContext is ready you need to make EF aware of it by registering it using code-based configuration. To do this, replace the following code
public class ModelConfiguration : DbConfiguration
{
public ModelConfiguration()
{
this.SetHistoryContext("System.Data.SqlClient",
(connection, defaultSchema) => new MyHistoryContext(connection, defaultSchema));
}
}
}
with the following code
public class ModelConfiguration : DbConfiguration
{
public ModelConfiguration()
{
this.SetHistoryContext("DDTek.Oracle",
(connection, defaultSchema) => new MyHistoryContext(connection, defaultSchema));
}
}