mh_jy_safe/APT.Data.Migrations/Migrations/20251104072719_wyw2025110401.cs
2025-11-07 11:03:11 +08:00

290 lines
16 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace APT.Data.Migrations.Migrations
{
public partial class wyw2025110401 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "T_SE_TRAIN_PLAN",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PLAN_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
TYPE = table.Column<int>(type: "int", nullable: false),
YEAR = table.Column<int>(type: "int", nullable: false),
LAUNCH_TIME = table.Column<DateTime>(type: "datetime2", nullable: false),
END_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
DEPARTMENT_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LAUNCH_USER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
PLAN_NAME = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
GUIDE_PRINCIPLE = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
TRAIN_REQUIREMENT = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
PERSENT = table.Column<decimal>(type: "decimal(18,2)", nullable: true),
STATUS = table.Column<int>(type: "int", nullable: false),
IS_DELETED = table.Column<bool>(type: "bit", nullable: false),
ORG_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ENTITY_ORG_TPYE = table.Column<int>(type: "int", nullable: false),
FORM_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
FLOW_STATUS = table.Column<int>(type: "int", nullable: false),
FLOW_SEND_STATUS = table.Column<int>(type: "int", nullable: false),
FLOW_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CREATE_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
MODIFY_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
CREATER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MODIFIER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_T_SE_TRAIN_PLAN", x => x.ID);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_T_FM_DEPARTMENT_DEPARTMENT_ID",
column: x => x.DEPARTMENT_ID,
principalTable: "T_FM_DEPARTMENT",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_T_FM_ORGANIZATION_ORG_ID",
column: x => x.ORG_ID,
principalTable: "T_FM_ORGANIZATION",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_T_FM_USER_LAUNCH_USER_ID",
column: x => x.LAUNCH_USER_ID,
principalTable: "T_FM_USER",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "T_SE_TRAIN_PLAN_DETAIL",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PLAN_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PLAN_DETAIL_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
DATE_TRAIN = table.Column<DateTime>(type: "datetime2", nullable: false),
IN_OUT = table.Column<int>(type: "int", nullable: false),
TYPE_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
NAME = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
OBJECT = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
TRAINTYPE = table.Column<int>(type: "int", nullable: false),
CHECKTYPE = table.Column<int>(type: "int", nullable: false),
CLASSHOUR = table.Column<int>(type: "int", nullable: false),
SPRINTTYPE = table.Column<int>(type: "int", nullable: false),
ISALL = table.Column<bool>(type: "bit", nullable: false),
DEPARTMENT_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
STATUS = table.Column<int>(type: "int", nullable: false),
IS_DELETED = table.Column<bool>(type: "bit", nullable: false),
ORG_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ENTITY_ORG_TPYE = table.Column<int>(type: "int", nullable: false),
FORM_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
FLOW_STATUS = table.Column<int>(type: "int", nullable: false),
FLOW_SEND_STATUS = table.Column<int>(type: "int", nullable: false),
FLOW_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CREATE_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
MODIFY_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
CREATER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MODIFIER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_T_SE_TRAIN_PLAN_DETAIL", x => x.ID);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_DETAIL_T_FM_DEPARTMENT_DEPARTMENT_ID",
column: x => x.DEPARTMENT_ID,
principalTable: "T_FM_DEPARTMENT",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_DETAIL_T_FM_ORGANIZATION_ORG_ID",
column: x => x.ORG_ID,
principalTable: "T_FM_ORGANIZATION",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_DETAIL_T_SE_TRAIN_PLAN_PLAN_ID",
column: x => x.PLAN_ID,
principalTable: "T_SE_TRAIN_PLAN",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_DETAIL_T_SE_TRAIN_TYPE_ENUM_TYPE_ID",
column: x => x.TYPE_ID,
principalTable: "T_SE_TRAIN_TYPE_ENUM",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "T_SE_TRAIN_PLAN_FILE",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PLAN_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IMG_FILE_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IS_DELETED = table.Column<bool>(type: "bit", nullable: false),
ORG_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ENTITY_ORG_TPYE = table.Column<int>(type: "int", nullable: false),
FORM_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
FLOW_STATUS = table.Column<int>(type: "int", nullable: false),
FLOW_SEND_STATUS = table.Column<int>(type: "int", nullable: false),
FLOW_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CREATE_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
MODIFY_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
CREATER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MODIFIER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_T_SE_TRAIN_PLAN_FILE", x => x.ID);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_FILE_T_FM_ORGANIZATION_ORG_ID",
column: x => x.ORG_ID,
principalTable: "T_FM_ORGANIZATION",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_FILE_T_PF_IMG_FILE_IMG_FILE_ID",
column: x => x.IMG_FILE_ID,
principalTable: "T_PF_IMG_FILE",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_FILE_T_SE_TRAIN_PLAN_PLAN_ID",
column: x => x.PLAN_ID,
principalTable: "T_SE_TRAIN_PLAN",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PLAN_DETAIL_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
DEPARTMENT_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
IS_DELETED = table.Column<bool>(type: "bit", nullable: false),
ORG_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ENTITY_ORG_TPYE = table.Column<int>(type: "int", nullable: false),
FORM_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
FLOW_STATUS = table.Column<int>(type: "int", nullable: false),
FLOW_SEND_STATUS = table.Column<int>(type: "int", nullable: false),
FLOW_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CREATE_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
MODIFY_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
CREATER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
MODIFIER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT", x => x.ID);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT_T_FM_DEPARTMENT_DEPARTMENT_ID",
column: x => x.DEPARTMENT_ID,
principalTable: "T_FM_DEPARTMENT",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT_T_FM_ORGANIZATION_ORG_ID",
column: x => x.ORG_ID,
principalTable: "T_FM_ORGANIZATION",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT_T_SE_TRAIN_PLAN_DETAIL_PLAN_DETAIL_ID",
column: x => x.PLAN_DETAIL_ID,
principalTable: "T_SE_TRAIN_PLAN_DETAIL",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_DEPARTMENT_ID",
table: "T_SE_TRAIN_PLAN",
column: "DEPARTMENT_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_LAUNCH_USER_ID",
table: "T_SE_TRAIN_PLAN",
column: "LAUNCH_USER_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_ORG_ID",
table: "T_SE_TRAIN_PLAN",
column: "ORG_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT_ID",
table: "T_SE_TRAIN_PLAN_DETAIL",
column: "DEPARTMENT_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_DETAIL_ORG_ID",
table: "T_SE_TRAIN_PLAN_DETAIL",
column: "ORG_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_DETAIL_PLAN_ID",
table: "T_SE_TRAIN_PLAN_DETAIL",
column: "PLAN_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_DETAIL_TYPE_ID",
table: "T_SE_TRAIN_PLAN_DETAIL",
column: "TYPE_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT_DEPARTMENT_ID",
table: "T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT",
column: "DEPARTMENT_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT_ORG_ID",
table: "T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT",
column: "ORG_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT_PLAN_DETAIL_ID",
table: "T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT",
column: "PLAN_DETAIL_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_FILE_IMG_FILE_ID",
table: "T_SE_TRAIN_PLAN_FILE",
column: "IMG_FILE_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_FILE_ORG_ID",
table: "T_SE_TRAIN_PLAN_FILE",
column: "ORG_ID");
migrationBuilder.CreateIndex(
name: "IX_T_SE_TRAIN_PLAN_FILE_PLAN_ID",
table: "T_SE_TRAIN_PLAN_FILE",
column: "PLAN_ID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "T_SE_TRAIN_PLAN_DETAIL_DEPARTMENT");
migrationBuilder.DropTable(
name: "T_SE_TRAIN_PLAN_FILE");
migrationBuilder.DropTable(
name: "T_SE_TRAIN_PLAN_DETAIL");
migrationBuilder.DropTable(
name: "T_SE_TRAIN_PLAN");
}
}
}