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

@ -0,0 +1,84 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Hcs.WebApp.Data.Hcs.Migrations
{
/// <inheritdoc />
public partial class CreateHcsSchema : Migration
{
/// <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<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 =>
{
table.PrimaryKey("PK_Registries", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Elements",
columns: table => new
{
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)
},
constraints: table =>
{
table.PrimaryKey("PK_Elements", x => x.Id);
table.ForeignKey(
name: "FK_Elements_Registries_RegistryId",
column: x => x.RegistryId,
principalTable: "Registries",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Elements_RegistryId",
table: "Elements",
column: "RegistryId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Elements");
migrationBuilder.DropTable(
name: "Operations");
migrationBuilder.DropTable(
name: "Registries");
}
}
}