diff --git a/Complex.EndPoint/Program.cs b/Complex.EndPoint/Program.cs index b83a6bc..43d430b 100644 --- a/Complex.EndPoint/Program.cs +++ b/Complex.EndPoint/Program.cs @@ -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 diff --git a/Complex.Infrastructure/ComplexDBContext.cs b/Complex.Infrastructure/ComplexDBContext.cs index 549d969..3ff5288 100644 --- a/Complex.Infrastructure/ComplexDBContext.cs +++ b/Complex.Infrastructure/ComplexDBContext.cs @@ -53,19 +53,30 @@ namespace Complex.Infrastructure builder.Entity().HasQueryFilter(b => EF.Property(b, "IsRemoved") == false); builder.Entity().HasQueryFilter(b => EF.Property(b, "IsRemoved") == false); builder.Entity().HasQueryFilter(b => EF.Property(b, "IsRemoved") == false); - //builder.ApplyGlobalFilters("IsRemoved", false); - // var allEntities = modelBuilder.Model.GetEntityTypes(); - //Expression> filterExpr = bm => (bm.GetProperty("IsRemoved").ToString() == "0"); - //foreach (var entity in builder.Model.GetEntityTypes()) - //{ - // //if (!entity.ClrType.IsAssignableTo(typeof(BaseEntity))) - // // continue; - // if (entity.ClrType.GetCustomAttributes(typeof(AuditableAttribute), true).Length > 0) - // entity - // //entity.SetQueryFilter(filterExpr); - //} + // Configure many-to-many between CostCycle and Unit + // SQL Server does not allow multiple cascade paths, so one side must use NoAction + builder.Entity() + .HasMany(cc => cc.Units) + .WithMany(u => u.CostCycles) + .UsingEntity>( + "CostCycleUnit", + j => j.HasOne().WithMany().HasForeignKey("UnitsId").OnDelete(DeleteBehavior.NoAction), + j => j.HasOne().WithMany().HasForeignKey("CostCyclesId").OnDelete(DeleteBehavior.Cascade)); + // Configure UnitCost relationships to avoid multiple cascade paths + // UnitCost -> CostCycle (Cascade) and UnitCost -> Unit (NoAction) + builder.Entity() + .HasOne(uc => uc.CostCycle) + .WithMany() + .HasForeignKey(uc => uc.CostCycleId) + .OnDelete(DeleteBehavior.Cascade); + + builder.Entity() + .HasOne(uc => uc.Unit) + .WithMany() + .HasForeignKey(uc => uc.UnitId) + .OnDelete(DeleteBehavior.NoAction); } diff --git a/Complex.Infrastructure/Migrations/20260608224155_InitialCreate.Designer.cs b/Complex.Infrastructure/Migrations/20260608225159_InitialCreate.Designer.cs similarity index 98% rename from Complex.Infrastructure/Migrations/20260608224155_InitialCreate.Designer.cs rename to Complex.Infrastructure/Migrations/20260608225159_InitialCreate.Designer.cs index 28fae75..44cb197 100644 --- a/Complex.Infrastructure/Migrations/20260608224155_InitialCreate.Designer.cs +++ b/Complex.Infrastructure/Migrations/20260608225159_InitialCreate.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Complex.Infrastructure.Migrations { [DbContext(typeof(ComplexDBContext))] - [Migration("20260608224155_InitialCreate")] + [Migration("20260608225159_InitialCreate")] partial class InitialCreate { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -119,7 +119,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(350)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(1882)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -178,7 +178,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(2221)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(3884)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -254,7 +254,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(3082)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(4981)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -306,7 +306,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(4033)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(6348)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -349,7 +349,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(5727)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(8225)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -397,7 +397,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(7277)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 647, DateTimeKind.Local).AddTicks(86)); b.Property("IsActive") .HasColumnType("bit"); @@ -517,7 +517,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(9359)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 648, DateTimeKind.Local).AddTicks(3522)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -588,7 +588,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(1589)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 649, DateTimeKind.Local).AddTicks(412)); b.Property("IsActive") .HasColumnType("bit"); @@ -659,7 +659,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(3756)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 649, DateTimeKind.Local).AddTicks(6073)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -705,7 +705,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(4973)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 650, DateTimeKind.Local).AddTicks(161)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -949,7 +949,7 @@ namespace Complex.Infrastructure.Migrations b.HasOne("Complex.Domain.Entities.Unit", "Unit") .WithMany() .HasForeignKey("UnitId") - .OnDelete(DeleteBehavior.Cascade) + .OnDelete(DeleteBehavior.NoAction) .IsRequired(); b.Navigation("CostCycle"); @@ -979,7 +979,7 @@ namespace Complex.Infrastructure.Migrations b.HasOne("Complex.Domain.Entities.Unit", null) .WithMany() .HasForeignKey("UnitsId") - .OnDelete(DeleteBehavior.Cascade) + .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); diff --git a/Complex.Infrastructure/Migrations/20260608224155_InitialCreate.cs b/Complex.Infrastructure/Migrations/20260608225159_InitialCreate.cs similarity index 97% rename from Complex.Infrastructure/Migrations/20260608224155_InitialCreate.cs rename to Complex.Infrastructure/Migrations/20260608225159_InitialCreate.cs index 5924fff..c5ce14c 100644 --- a/Complex.Infrastructure/Migrations/20260608224155_InitialCreate.cs +++ b/Complex.Infrastructure/Migrations/20260608225159_InitialCreate.cs @@ -51,7 +51,7 @@ namespace Complex.Infrastructure.Migrations RegisterMobileNumber = table.Column(type: "nvarchar(max)", nullable: false), Body = table.Column(type: "nvarchar(max)", nullable: false), Description = table.Column(type: "nvarchar(max)", nullable: true), - InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(3082)), + InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(4981)), IsRemoved = table.Column(type: "bit", nullable: false, defaultValue: false), RemoveTime = table.Column(type: "datetime2", nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true) @@ -71,7 +71,7 @@ namespace Complex.Infrastructure.Migrations Gender = table.Column(type: "tinyint", nullable: true), Avatar = table.Column(type: "varbinary(max)", nullable: true), IsActive = table.Column(type: "bit", nullable: false), - InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(7277)), + InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 647, DateTimeKind.Local).AddTicks(86)), IsRemoved = table.Column(type: "bit", nullable: false, defaultValue: false), RemoveTime = table.Column(type: "datetime2", nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true) @@ -135,7 +135,7 @@ namespace Complex.Infrastructure.Migrations ComplexId = table.Column(type: "uniqueidentifier", nullable: true), Title = table.Column(type: "nvarchar(max)", nullable: false), Icon = table.Column(type: "nvarchar(max)", nullable: false), - InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(4973)), + InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 650, DateTimeKind.Local).AddTicks(161)), IsRemoved = table.Column(type: "bit", nullable: false, defaultValue: false), RemoveTime = table.Column(type: "datetime2", nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true) @@ -223,7 +223,7 @@ namespace Complex.Infrastructure.Migrations ParentId = table.Column(type: "uniqueidentifier", nullable: true), Description = table.Column(type: "nvarchar(max)", nullable: true), CityId = table.Column(type: "int", nullable: false), - InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(350)), + InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(1882)), IsRemoved = table.Column(type: "bit", nullable: false, defaultValue: false), RemoveTime = table.Column(type: "datetime2", nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true) @@ -254,7 +254,7 @@ namespace Complex.Infrastructure.Migrations ManagerMobileNumberId = table.Column(type: "nvarchar(450)", nullable: true), StartDate = table.Column(type: "nvarchar(max)", nullable: false), EndDate = table.Column(type: "nvarchar(max)", nullable: false), - InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(2221)), + InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(3884)), IsRemoved = table.Column(type: "bit", nullable: false, defaultValue: false), RemoveTime = table.Column(type: "datetime2", nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true) @@ -285,7 +285,7 @@ namespace Complex.Infrastructure.Migrations TransactionTypeId = table.Column(type: "int", nullable: false), ComplexId = table.Column(type: "uniqueidentifier", nullable: true), RegisterMobileNumber = table.Column(type: "nvarchar(max)", nullable: true), - InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(5727)), + InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(8225)), IsRemoved = table.Column(type: "bit", nullable: false, defaultValue: false), RemoveTime = table.Column(type: "datetime2", nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true) @@ -324,7 +324,7 @@ namespace Complex.Infrastructure.Migrations StateId = table.Column(type: "int", nullable: true), Floor = table.Column(type: "int", nullable: true), ManagerDescription = table.Column(type: "nvarchar(max)", nullable: true), - InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(1589)), + InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 649, DateTimeKind.Local).AddTicks(412)), IsRemoved = table.Column(type: "bit", nullable: false, defaultValue: false), RemoveTime = table.Column(type: "datetime2", nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true) @@ -368,7 +368,7 @@ namespace Complex.Infrastructure.Migrations EncouragementDay = table.Column(type: "int", nullable: false), EncouragementAmount = table.Column(type: "bigint", nullable: false), IncomeCostTitleId = table.Column(type: "int", nullable: true), - InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(4033)), + InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(6348)), IsRemoved = table.Column(type: "bit", nullable: false, defaultValue: false), RemoveTime = table.Column(type: "datetime2", nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true) @@ -409,8 +409,7 @@ namespace Complex.Infrastructure.Migrations name: "FK_CostCycleUnit_Units_UnitsId", column: x => x.UnitsId, principalTable: "Units", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -423,7 +422,7 @@ namespace Complex.Infrastructure.Migrations UnitId = table.Column(type: "uniqueidentifier", nullable: false), TransactionId = table.Column(type: "int", nullable: true), Date = table.Column(type: "date", nullable: false), - InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(3756)), + InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 649, DateTimeKind.Local).AddTicks(6073)), IsRemoved = table.Column(type: "bit", nullable: false, defaultValue: false), RemoveTime = table.Column(type: "datetime2", nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true) @@ -441,8 +440,7 @@ namespace Complex.Infrastructure.Migrations name: "FK_UnitCosts_Units_UnitId", column: x => x.UnitId, principalTable: "Units", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); }); migrationBuilder.CreateTable( @@ -462,7 +460,7 @@ namespace Complex.Infrastructure.Migrations ComplexId = table.Column(type: "uniqueidentifier", nullable: false), UnitCostId = table.Column(type: "bigint", nullable: false), PersonId = table.Column(type: "nvarchar(450)", nullable: false), - InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(9359)), + InsertTime = table.Column(type: "datetime2", nullable: false, defaultValue: new DateTime(2026, 6, 9, 2, 21, 59, 648, DateTimeKind.Local).AddTicks(3522)), IsRemoved = table.Column(type: "bit", nullable: false, defaultValue: false), RemoveTime = table.Column(type: "datetime2", nullable: true), UpdateTime = table.Column(type: "datetime2", nullable: true) diff --git a/Complex.Infrastructure/Migrations/ComplexDBContextModelSnapshot.cs b/Complex.Infrastructure/Migrations/ComplexDBContextModelSnapshot.cs index bb6641e..bf303b9 100644 --- a/Complex.Infrastructure/Migrations/ComplexDBContextModelSnapshot.cs +++ b/Complex.Infrastructure/Migrations/ComplexDBContextModelSnapshot.cs @@ -117,7 +117,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(350)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(1882)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -176,7 +176,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(2221)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(3884)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -252,7 +252,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(3082)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(4981)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -304,7 +304,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(4033)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(6348)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -347,7 +347,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(5727)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 646, DateTimeKind.Local).AddTicks(8225)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -395,7 +395,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(7277)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 647, DateTimeKind.Local).AddTicks(86)); b.Property("IsActive") .HasColumnType("bit"); @@ -515,7 +515,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 153, DateTimeKind.Local).AddTicks(9359)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 648, DateTimeKind.Local).AddTicks(3522)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -586,7 +586,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(1589)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 649, DateTimeKind.Local).AddTicks(412)); b.Property("IsActive") .HasColumnType("bit"); @@ -657,7 +657,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(3756)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 649, DateTimeKind.Local).AddTicks(6073)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -703,7 +703,7 @@ namespace Complex.Infrastructure.Migrations b.Property("InsertTime") .ValueGeneratedOnAdd() .HasColumnType("datetime2") - .HasDefaultValue(new DateTime(2026, 6, 9, 2, 11, 55, 154, DateTimeKind.Local).AddTicks(4973)); + .HasDefaultValue(new DateTime(2026, 6, 9, 2, 21, 59, 650, DateTimeKind.Local).AddTicks(161)); b.Property("IsRemoved") .ValueGeneratedOnAdd() @@ -947,7 +947,7 @@ namespace Complex.Infrastructure.Migrations b.HasOne("Complex.Domain.Entities.Unit", "Unit") .WithMany() .HasForeignKey("UnitId") - .OnDelete(DeleteBehavior.Cascade) + .OnDelete(DeleteBehavior.NoAction) .IsRequired(); b.Navigation("CostCycle"); @@ -977,7 +977,7 @@ namespace Complex.Infrastructure.Migrations b.HasOne("Complex.Domain.Entities.Unit", null) .WithMany() .HasForeignKey("UnitsId") - .OnDelete(DeleteBehavior.Cascade) + .OnDelete(DeleteBehavior.NoAction) .IsRequired(); });