Merge migrations

This commit is contained in:
2025-10-23 18:33:56 +09:00
parent 608dcc2098
commit ce78e3a2ad
10 changed files with 60 additions and 284 deletions

View File

@ -1,82 +0,0 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Hcs.WebApp.Data.Hcs.Migrations
{
[DbContext(typeof(HcsDbContext))]
[Migration("20251022073558_CreateHcsSchema")]
partial class CreateHcsSchema
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.Registry", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("Number")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Registries");
});
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.RegistryElement", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("GUID")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("RegistryId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("Xml")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("RegistryId");
b.ToTable("Elements");
});
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.RegistryElement", b =>
{
b.HasOne("Hcs.WebApp.Data.Hcs.Registry", "Registry")
.WithMany("Elements")
.HasForeignKey("RegistryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Registry");
});
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.Registry", b =>
{
b.Navigation("Elements");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,85 +0,0 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Hcs.WebApp.Data.Hcs.Migrations
{
[DbContext(typeof(HcsDbContext))]
[Migration("20251022075934_SpecifyCommonRegistry")]
partial class SpecifyCommonRegistry
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.Registry", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<bool>("IsCommon")
.HasColumnType("bit");
b.Property<int>("Number")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Registries");
});
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.RegistryElement", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("GUID")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("RegistryId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("Xml")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("RegistryId");
b.ToTable("Elements");
});
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.RegistryElement", b =>
{
b.HasOne("Hcs.WebApp.Data.Hcs.Registry", "Registry")
.WithMany("Elements")
.HasForeignKey("RegistryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Registry");
});
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.Registry", b =>
{
b.Navigation("Elements");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -1,28 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Hcs.WebApp.Data.Hcs.Migrations
{
/// <inheritdoc />
public partial class SpecifyCommonRegistry : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsCommon",
table: "Registries",
type: "bit",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsCommon",
table: "Registries");
}
}
}

View File

@ -1,58 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Hcs.WebApp.Data.Hcs.Migrations
{
/// <inheritdoc />
public partial class AddOperation : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Name",
table: "Registries",
type: "nvarchar(max)",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<DateTime>(
name: "UpdatedAt",
table: "Registries",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.CreateTable(
name: "Operations",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
Type = table.Column<string>(type: "nvarchar(max)", nullable: false),
InitiatorId = table.Column<string>(type: "nvarchar(max)", nullable: false),
StartedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
EndedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
MessageGuid = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Operations", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Operations");
migrationBuilder.DropColumn(
name: "Name",
table: "Registries");
migrationBuilder.DropColumn(
name: "UpdatedAt",
table: "Registries");
}
}
}

View File

@ -7,8 +7,8 @@ using Microsoft.EntityFrameworkCore.Migrations;
namespace Hcs.WebApp.Data.Hcs.Migrations
{
[DbContext(typeof(HcsDbContext))]
[Migration("20251023014411_AddOperation")]
partial class AddOperation
[Migration("20251023092729_CreateHcsSchema")]
public partial class CreateHcsSchema
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@ -22,8 +22,11 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.Operation", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("EndedAt")
.HasColumnType("datetime2");
@ -33,7 +36,6 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
.HasColumnType("nvarchar(max)");
b.Property<string>("MessageGuid")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("StartedAt")
@ -50,8 +52,9 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.Registry", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsCommon")
.HasColumnType("bit");
@ -73,8 +76,9 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.RegistryElement", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
@ -84,9 +88,8 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("RegistryId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<Guid>("RegistryId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Xml")
.IsRequired()

View File

@ -9,12 +9,32 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Operations",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Type = table.Column<string>(type: "nvarchar(max)", nullable: false),
InitiatorId = table.Column<string>(type: "nvarchar(max)", nullable: false),
StartedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
EndedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
MessageGuid = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Operations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Registries",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
Number = table.Column<int>(type: "int", nullable: false)
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Number = table.Column<int>(type: "int", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
IsCommon = table.Column<bool>(type: "bit", nullable: false),
UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
@ -25,8 +45,8 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
name: "Elements",
columns: table => new
{
Id = table.Column<string>(type: "nvarchar(450)", nullable: false),
RegistryId = table.Column<string>(type: "nvarchar(450)", nullable: false),
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
RegistryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Code = table.Column<string>(type: "nvarchar(max)", nullable: false),
GUID = table.Column<string>(type: "nvarchar(max)", nullable: false),
Xml = table.Column<string>(type: "nvarchar(max)", nullable: false)
@ -54,6 +74,9 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
migrationBuilder.DropTable(
name: "Elements");
migrationBuilder.DropTable(
name: "Operations");
migrationBuilder.DropTable(
name: "Registries");
}

View File

@ -19,8 +19,11 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.Operation", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<DateTime?>("EndedAt")
.HasColumnType("datetime2");
@ -30,7 +33,6 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
.HasColumnType("nvarchar(max)");
b.Property<string>("MessageGuid")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("StartedAt")
@ -47,8 +49,9 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.Registry", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsCommon")
.HasColumnType("bit");
@ -70,8 +73,9 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
modelBuilder.Entity("Hcs.WebApp.Data.Hcs.RegistryElement", b =>
{
b.Property<string>("Id")
.HasColumnType("nvarchar(450)");
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
@ -81,9 +85,8 @@ namespace Hcs.WebApp.Data.Hcs.Migrations
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("RegistryId")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<Guid>("RegistryId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Xml")
.IsRequired()