Fix last migration

This commit is contained in:
2025-10-28 16:05:35 +09:00
parent 53df5e1767
commit 683d600cb0
6 changed files with 15 additions and 26 deletions

View File

@ -22,9 +22,9 @@ namespace Hcs.WebApp.Data.Hcs
public DateTime? EndedAt { get; set; } 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<Operation> Operations { get; set; } = []; public virtual ICollection<Operation> Operations { get; set; } = [];

View File

@ -7,7 +7,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace Hcs.WebApp.Data.Hcs.Migrations namespace Hcs.WebApp.Data.Hcs.Migrations
{ {
[DbContext(typeof(HcsDbContext))] [DbContext(typeof(HcsDbContext))]
[Migration("20251028063057_CreateHcsSchema")] [Migration("20251028065710_CreateHcsSchema")]
public partial class CreateHcsSchema public partial class CreateHcsSchema
{ {
/// <inheritdoc /> /// <inheritdoc />
@ -35,7 +35,6 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("FailureReason") b.Property<string>("FailureReason")
.IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("InitiatorId") b.Property<string>("InitiatorId")
@ -75,7 +74,6 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("FailureReason") b.Property<string>("FailureReason")
.IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("MessageGuid") b.Property<string>("MessageGuid")
@ -105,10 +103,9 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<string>("LastSyncError") b.Property<string>("LastSyncError")
.IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int>("LastSyncOperationId") b.Property<int?>("LastSyncOperationId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Name") b.Property<string>("Name")
@ -171,9 +168,7 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
{ {
b.HasOne("Hcs.WebApp.Data.Hcs.Operation", "LastSyncOperation") b.HasOne("Hcs.WebApp.Data.Hcs.Operation", "LastSyncOperation")
.WithMany("Registries") .WithMany("Registries")
.HasForeignKey("LastSyncOperationId") .HasForeignKey("LastSyncOperationId");
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LastSyncOperation"); b.Navigation("LastSyncOperation");
}); });

View File

@ -21,7 +21,7 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
StartedAt = table.Column<DateTime>(type: "datetime2", nullable: true), StartedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
EndedAt = table.Column<DateTime>(type: "datetime2", nullable: true), EndedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
Step = table.Column<int>(type: "int", nullable: false), Step = table.Column<int>(type: "int", nullable: false),
FailureReason = table.Column<string>(type: "nvarchar(max)", nullable: false) FailureReason = table.Column<string>(type: "nvarchar(max)", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -40,7 +40,7 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
StartedAt = table.Column<DateTime>(type: "datetime2", nullable: true), StartedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
EndedAt = table.Column<DateTime>(type: "datetime2", nullable: true), EndedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
MessageGuid = table.Column<string>(type: "nvarchar(max)", nullable: true), MessageGuid = table.Column<string>(type: "nvarchar(max)", nullable: true),
FailureReason = table.Column<string>(type: "nvarchar(max)", nullable: false) FailureReason = table.Column<string>(type: "nvarchar(max)", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -62,8 +62,8 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
Name = table.Column<string>(type: "nvarchar(max)", nullable: false), Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsCommon = table.Column<bool>(type: "bit", nullable: false), IsCommon = table.Column<bool>(type: "bit", nullable: false),
SyncedAt = table.Column<DateTime>(type: "datetime2", nullable: true), SyncedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
LastSyncOperationId = table.Column<int>(type: "int", nullable: false), LastSyncOperationId = table.Column<int>(type: "int", nullable: true),
LastSyncError = table.Column<string>(type: "nvarchar(max)", nullable: false) LastSyncError = table.Column<string>(type: "nvarchar(max)", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
@ -72,8 +72,7 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
name: "FK_Registries_Operations_LastSyncOperationId", name: "FK_Registries_Operations_LastSyncOperationId",
column: x => x.LastSyncOperationId, column: x => x.LastSyncOperationId,
principalTable: "Operations", principalTable: "Operations",
principalColumn: "Id", principalColumn: "Id");
onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(

View File

@ -32,7 +32,6 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("FailureReason") b.Property<string>("FailureReason")
.IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("InitiatorId") b.Property<string>("InitiatorId")
@ -72,7 +71,6 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
.HasColumnType("datetime2"); .HasColumnType("datetime2");
b.Property<string>("FailureReason") b.Property<string>("FailureReason")
.IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<string>("MessageGuid") b.Property<string>("MessageGuid")
@ -102,10 +100,9 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
.HasColumnType("bit"); .HasColumnType("bit");
b.Property<string>("LastSyncError") b.Property<string>("LastSyncError")
.IsRequired()
.HasColumnType("nvarchar(max)"); .HasColumnType("nvarchar(max)");
b.Property<int>("LastSyncOperationId") b.Property<int?>("LastSyncOperationId")
.HasColumnType("int"); .HasColumnType("int");
b.Property<string>("Name") b.Property<string>("Name")
@ -168,9 +165,7 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
{ {
b.HasOne("Hcs.WebApp.Data.Hcs.Operation", "LastSyncOperation") b.HasOne("Hcs.WebApp.Data.Hcs.Operation", "LastSyncOperation")
.WithMany("Registries") .WithMany("Registries")
.HasForeignKey("LastSyncOperationId") .HasForeignKey("LastSyncOperationId");
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LastSyncOperation"); b.Navigation("LastSyncOperation");
}); });

View File

@ -26,7 +26,7 @@ namespace Hcs.WebApp.Data.Hcs
public string? MessageGuid { get; set; } public string? MessageGuid { get; set; }
public string FailureReason { get; set; } public string? FailureReason { get; set; }
public virtual ICollection<Registry> Registries { get; set; } = []; public virtual ICollection<Registry> Registries { get; set; } = [];

View File

@ -12,11 +12,11 @@
public DateTime? SyncedAt { get; set; } public DateTime? SyncedAt { get; set; }
public int LastSyncOperationId { get; set; } public int? LastSyncOperationId { get; set; }
public virtual Operation LastSyncOperation { get; set; } public virtual Operation LastSyncOperation { get; set; }
public string LastSyncError { get; set; } public string? LastSyncError { get; set; }
public virtual ICollection<RegistryElement> Elements { get; set; } = []; public virtual ICollection<RegistryElement> Elements { get; set; } = [];
} }