fix(db): update migration and configure many-to-many relationships to avoid cascade paths

- Regenerated InitialCreate migration to reflect new entity configurations
- Configured many-to-many relationship between CostCycle and Unit with NoAction on Unit side to prevent multiple cascade paths
- Updated UnitCost relationships: Cascade from CostCycle, NoAction from Unit
- Removed commented-out global filter code and replaced with explicit relationship configurations
This commit is contained in:
2026-06-09 02:23:09 +03:30
parent 569e39b58d
commit 6644db7e78
5 changed files with 61 additions and 52 deletions

View File

@@ -200,8 +200,8 @@ using (var scope = app.Services.CreateScope())
"BEGIN " +
"CREATE TABLE [__EFMigrationsHistory] ([MigrationId] nvarchar(150) NOT NULL, [ProductVersion] nvarchar(32) NOT NULL, PRIMARY KEY ([MigrationId])); " +
"END " +
"IF NOT EXISTS (SELECT * FROM __EFMigrationsHistory WHERE MigrationId = '20260608224155_InitialCreate') " +
"INSERT INTO __EFMigrationsHistory (MigrationId, ProductVersion) VALUES ('20260608224155_InitialCreate', '6.0.3')");
"IF NOT EXISTS (SELECT * FROM __EFMigrationsHistory WHERE MigrationId = '20260608225159_InitialCreate') " +
"INSERT INTO __EFMigrationsHistory (MigrationId, ProductVersion) VALUES ('20260608225159_InitialCreate', '6.0.3')");
}
}
catch