You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When add temporal table and set history table schema, if add migration again in future, extra incorrect migrations are created.
In DbContext.OnModelCreating made many existing tables temporal by adding .IsTemporal()
modelBuilder.Entity<MyEntity>()
.ToTable("MyEntity", b => b.IsTemporal());
Set history schema and temporal column names on all like this
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
if (entityType.IsTemporal())
{
entityType.SetHistoryTableSchema("history");
entityType.SetPeriodStartPropertyName("ValidFrom");
entityType.SetPeriodEndPropertyName("ValidTo");
}
}
Generated and applied migrations to DB. All seems well. Make additional changes and generate new migrations. Get an incorrect migration for each temporal table in addition to the expected migrations for the real changes:
Edit - deleted all existing migrations and just generated a first one immediately followed by another. Same incorrect behavior. Incorrect migrations included in second for all temporal tables despite no changes having been made.
EF Core version: 6.0.4
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: NET 6.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.1.6
The text was updated successfully, but these errors were encountered:
@maumar ok thanks. I see its already marked as fixed for 7.0 (and maybe a 6.x release?). Until it hits, I think Ill just continue to manually remove the unwanted migrations rather then add that extra code to the many tables since it soon wont be needed.
When add temporal table and set history table schema, if add migration again in future, extra incorrect migrations are created.
In DbContext.OnModelCreating made many existing tables temporal by adding .IsTemporal()
Set history schema and temporal column names on all like this
Generated and applied migrations to DB. All seems well. Make additional changes and generate new migrations. Get an incorrect migration for each temporal table in addition to the expected migrations for the real changes:
Edit - deleted all existing migrations and just generated a first one immediately followed by another. Same incorrect behavior. Incorrect migrations included in second for all temporal tables despite no changes having been made.
EF Core version: 6.0.4
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: NET 6.0
Operating system: Windows 11
IDE: Visual Studio 2022 17.1.6
The text was updated successfully, but these errors were encountered: