From 683d600cb0684cc002b328dce2ea589b4c207345 Mon Sep 17 00:00:00 2001 From: "HOME-LAPTOP\\kshkulev" Date: Tue, 28 Oct 2025 16:05:35 +0900 Subject: [PATCH] Fix last migration --- Hcs.WebApp/Data/Hcs/Campaign.cs | 4 ++-- ....cs => 20251028065710_CreateHcsSchema.Designer.cs} | 11 +++-------- ...HcsSchema.cs => 20251028065710_CreateHcsSchema.cs} | 11 +++++------ .../Data/Hcs/Migrations/HcsDbContextModelSnapshot.cs | 9 ++------- Hcs.WebApp/Data/Hcs/Operation.cs | 2 +- Hcs.WebApp/Data/Hcs/Registry.cs | 4 ++-- 6 files changed, 15 insertions(+), 26 deletions(-) rename Hcs.WebApp/Data/Hcs/Migrations/{20251028063057_CreateHcsSchema.Designer.cs => 20251028065710_CreateHcsSchema.Designer.cs} (94%) rename Hcs.WebApp/Data/Hcs/Migrations/{20251028063057_CreateHcsSchema.cs => 20251028065710_CreateHcsSchema.cs} (96%) diff --git a/Hcs.WebApp/Data/Hcs/Campaign.cs b/Hcs.WebApp/Data/Hcs/Campaign.cs index 881b663..6d44110 100644 --- a/Hcs.WebApp/Data/Hcs/Campaign.cs +++ b/Hcs.WebApp/Data/Hcs/Campaign.cs @@ -22,9 +22,9 @@ namespace Hcs.WebApp.Data.Hcs public DateTime? EndedAt { get; set; } - public int Step { get; set; } + public int Step { get; set; } = 0; - public string FailureReason { get; set; } + public string? FailureReason { get; set; } public virtual ICollection Operations { get; set; } = []; diff --git a/Hcs.WebApp/Data/Hcs/Migrations/20251028063057_CreateHcsSchema.Designer.cs b/Hcs.WebApp/Data/Hcs/Migrations/20251028065710_CreateHcsSchema.Designer.cs similarity index 94% rename from Hcs.WebApp/Data/Hcs/Migrations/20251028063057_CreateHcsSchema.Designer.cs rename to Hcs.WebApp/Data/Hcs/Migrations/20251028065710_CreateHcsSchema.Designer.cs index 9e6f3fa..91ca463 100644 --- a/Hcs.WebApp/Data/Hcs/Migrations/20251028063057_CreateHcsSchema.Designer.cs +++ b/Hcs.WebApp/Data/Hcs/Migrations/20251028065710_CreateHcsSchema.Designer.cs @@ -7,7 +7,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace Hcs.WebApp.Data.Hcs.Migrations { [DbContext(typeof(HcsDbContext))] - [Migration("20251028063057_CreateHcsSchema")] + [Migration("20251028065710_CreateHcsSchema")] public partial class CreateHcsSchema { /// @@ -35,7 +35,6 @@ namespace Hcs.WebApp.Data.Hcs.Migrations .HasColumnType("datetime2"); b.Property("FailureReason") - .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("InitiatorId") @@ -75,7 +74,6 @@ namespace Hcs.WebApp.Data.Hcs.Migrations .HasColumnType("datetime2"); b.Property("FailureReason") - .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("MessageGuid") @@ -105,10 +103,9 @@ namespace Hcs.WebApp.Data.Hcs.Migrations .HasColumnType("bit"); b.Property("LastSyncError") - .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("LastSyncOperationId") + b.Property("LastSyncOperationId") .HasColumnType("int"); b.Property("Name") @@ -171,9 +168,7 @@ namespace Hcs.WebApp.Data.Hcs.Migrations { b.HasOne("Hcs.WebApp.Data.Hcs.Operation", "LastSyncOperation") .WithMany("Registries") - .HasForeignKey("LastSyncOperationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("LastSyncOperationId"); b.Navigation("LastSyncOperation"); }); diff --git a/Hcs.WebApp/Data/Hcs/Migrations/20251028063057_CreateHcsSchema.cs b/Hcs.WebApp/Data/Hcs/Migrations/20251028065710_CreateHcsSchema.cs similarity index 96% rename from Hcs.WebApp/Data/Hcs/Migrations/20251028063057_CreateHcsSchema.cs rename to Hcs.WebApp/Data/Hcs/Migrations/20251028065710_CreateHcsSchema.cs index 7039d46..745f2bd 100644 --- a/Hcs.WebApp/Data/Hcs/Migrations/20251028063057_CreateHcsSchema.cs +++ b/Hcs.WebApp/Data/Hcs/Migrations/20251028065710_CreateHcsSchema.cs @@ -21,7 +21,7 @@ namespace Hcs.WebApp.Data.Hcs.Migrations StartedAt = table.Column(type: "datetime2", nullable: true), EndedAt = table.Column(type: "datetime2", nullable: true), Step = table.Column(type: "int", nullable: false), - FailureReason = table.Column(type: "nvarchar(max)", nullable: false) + FailureReason = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -40,7 +40,7 @@ namespace Hcs.WebApp.Data.Hcs.Migrations StartedAt = table.Column(type: "datetime2", nullable: true), EndedAt = table.Column(type: "datetime2", nullable: true), MessageGuid = table.Column(type: "nvarchar(max)", nullable: true), - FailureReason = table.Column(type: "nvarchar(max)", nullable: false) + FailureReason = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -62,8 +62,8 @@ namespace Hcs.WebApp.Data.Hcs.Migrations Name = table.Column(type: "nvarchar(max)", nullable: false), IsCommon = table.Column(type: "bit", nullable: false), SyncedAt = table.Column(type: "datetime2", nullable: true), - LastSyncOperationId = table.Column(type: "int", nullable: false), - LastSyncError = table.Column(type: "nvarchar(max)", nullable: false) + LastSyncOperationId = table.Column(type: "int", nullable: true), + LastSyncError = table.Column(type: "nvarchar(max)", nullable: true) }, constraints: table => { @@ -72,8 +72,7 @@ namespace Hcs.WebApp.Data.Hcs.Migrations name: "FK_Registries_Operations_LastSyncOperationId", column: x => x.LastSyncOperationId, principalTable: "Operations", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); + principalColumn: "Id"); }); migrationBuilder.CreateTable( diff --git a/Hcs.WebApp/Data/Hcs/Migrations/HcsDbContextModelSnapshot.cs b/Hcs.WebApp/Data/Hcs/Migrations/HcsDbContextModelSnapshot.cs index 74d8b13..b7525ca 100644 --- a/Hcs.WebApp/Data/Hcs/Migrations/HcsDbContextModelSnapshot.cs +++ b/Hcs.WebApp/Data/Hcs/Migrations/HcsDbContextModelSnapshot.cs @@ -32,7 +32,6 @@ namespace Hcs.WebApp.Data.Hcs.Migrations .HasColumnType("datetime2"); b.Property("FailureReason") - .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("InitiatorId") @@ -72,7 +71,6 @@ namespace Hcs.WebApp.Data.Hcs.Migrations .HasColumnType("datetime2"); b.Property("FailureReason") - .IsRequired() .HasColumnType("nvarchar(max)"); b.Property("MessageGuid") @@ -102,10 +100,9 @@ namespace Hcs.WebApp.Data.Hcs.Migrations .HasColumnType("bit"); b.Property("LastSyncError") - .IsRequired() .HasColumnType("nvarchar(max)"); - b.Property("LastSyncOperationId") + b.Property("LastSyncOperationId") .HasColumnType("int"); b.Property("Name") @@ -168,9 +165,7 @@ namespace Hcs.WebApp.Data.Hcs.Migrations { b.HasOne("Hcs.WebApp.Data.Hcs.Operation", "LastSyncOperation") .WithMany("Registries") - .HasForeignKey("LastSyncOperationId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("LastSyncOperationId"); b.Navigation("LastSyncOperation"); }); diff --git a/Hcs.WebApp/Data/Hcs/Operation.cs b/Hcs.WebApp/Data/Hcs/Operation.cs index 90daf5d..b83ed64 100644 --- a/Hcs.WebApp/Data/Hcs/Operation.cs +++ b/Hcs.WebApp/Data/Hcs/Operation.cs @@ -26,7 +26,7 @@ namespace Hcs.WebApp.Data.Hcs public string? MessageGuid { get; set; } - public string FailureReason { get; set; } + public string? FailureReason { get; set; } public virtual ICollection Registries { get; set; } = []; diff --git a/Hcs.WebApp/Data/Hcs/Registry.cs b/Hcs.WebApp/Data/Hcs/Registry.cs index fb17a0b..2147757 100644 --- a/Hcs.WebApp/Data/Hcs/Registry.cs +++ b/Hcs.WebApp/Data/Hcs/Registry.cs @@ -12,11 +12,11 @@ public DateTime? SyncedAt { get; set; } - public int LastSyncOperationId { get; set; } + public int? LastSyncOperationId { get; set; } public virtual Operation LastSyncOperation { get; set; } - public string LastSyncError { get; set; } + public string? LastSyncError { get; set; } public virtual ICollection Elements { get; set; } = []; }