mh_custom/wtmProject.DataAccess/Migrations/20240328025156_hmr2024032801.cs

84 lines
4.0 KiB
C#
Raw Normal View History

2024-05-16 17:30:33 +08:00
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace wtmProject.DataAccess.Migrations
{
public partial class hmr2024032801 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "WTM_CUSTOM",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CustomAllName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
CustomShortName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
ParentUnit = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
AreaId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TenantCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WTM_CUSTOM", x => x.ID);
table.ForeignKey(
name: "FK_WTM_CUSTOM_WTM_AREA_AreaId",
column: x => x.AreaId,
principalTable: "WTM_AREA",
principalColumn: "ID");
});
migrationBuilder.CreateTable(
name: "WTM_CUSTOM_PERSON",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CustomId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
PersonName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
PersonPhone = table.Column<string>(type: "nvarchar(max)", nullable: true),
PersonPost = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
TenantCode = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
CreateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
UpdateBy = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_WTM_CUSTOM_PERSON", x => x.ID);
table.ForeignKey(
name: "FK_WTM_CUSTOM_PERSON_WTM_CUSTOM_CustomId",
column: x => x.CustomId,
principalTable: "WTM_CUSTOM",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_WTM_CUSTOM_AreaId",
table: "WTM_CUSTOM",
column: "AreaId");
migrationBuilder.CreateIndex(
name: "IX_WTM_CUSTOM_PERSON_CustomId",
table: "WTM_CUSTOM_PERSON",
column: "CustomId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "WTM_CUSTOM_PERSON");
migrationBuilder.DropTable(
name: "WTM_CUSTOM");
}
}
}