Entity Framework Core - change schema of "__EFMigrationsHistory" table
Looking into source code (HistoryRepository.cs). You can configure custom migrations table and schema names, inside DbContext constructor
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
{
var relationalOptions = RelationalOptionsExtension.Extract(options);
relationalOptions.MigrationsHistoryTableName = "bar";
relationalOptions.MigrationsHistoryTableSchema = "foo";
}
or inside OnConfiguring method
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var relationalOptions = RelationalOptionsExtension.Extract(optionsBuilder.Options);
relationalOptions.MigrationsHistoryTableName = "bar";
relationalOptions.MigrationsHistoryTableSchema = "foo";
}
Do it in your call to UseSqlServer
.
optionsBuilder
.UseSqlServer(
"...",
x => x.MigrationsHistoryTable(
HistoryRepository.DefaultTableName,
"mySchema"));