mh_lcmk_sms_service/APT.Data.Migrations/Migrations/20240927062720_wyw2024092703.cs

166 lines
7.9 KiB
C#
Raw Permalink Normal View History

using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace APT.Data.Migrations.Migrations
{
public partial class wyw2024092703 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "USER_ID_SEND",
table: "T_BS_PLAN_SET",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.CreateTable(
name: "T_BS_PLAN_SET_AREA",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PLANSET_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AREA_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_BS_PLAN_SET_AREA", x => x.ID);
table.ForeignKey(
name: "FK_T_BS_PLAN_SET_AREA_T_BS_PLAN_SET_PLANSET_ID",
column: x => x.PLANSET_ID,
principalTable: "T_BS_PLAN_SET",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_BS_PLAN_SET_AREA_T_FM_ORGANIZATION_ORG_ID",
column: x => x.ORG_ID,
principalTable: "T_FM_ORGANIZATION",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_BS_PLAN_SET_AREA_T_HM_RISK_AREA_AREA_ID",
column: x => x.AREA_ID,
principalTable: "T_HM_RISK_AREA",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "T_BS_PLAN_SET_DEPARTMENT_OUT",
columns: table => new
{
ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
PLANSET_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
DEPARTMENT_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_BS_PLAN_SET_DEPARTMENT_OUT", x => x.ID);
table.ForeignKey(
name: "FK_T_BS_PLAN_SET_DEPARTMENT_OUT_T_BS_PLAN_SET_PLANSET_ID",
column: x => x.PLANSET_ID,
principalTable: "T_BS_PLAN_SET",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_BS_PLAN_SET_DEPARTMENT_OUT_T_FM_DEPARTMENT_DEPARTMENT_ID",
column: x => x.DEPARTMENT_ID,
principalTable: "T_FM_DEPARTMENT",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_T_BS_PLAN_SET_DEPARTMENT_OUT_T_FM_ORGANIZATION_ORG_ID",
column: x => x.ORG_ID,
principalTable: "T_FM_ORGANIZATION",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_T_BS_PLAN_SET_USER_ID_SEND",
table: "T_BS_PLAN_SET",
column: "USER_ID_SEND");
migrationBuilder.CreateIndex(
name: "IX_T_BS_PLAN_SET_AREA_AREA_ID",
table: "T_BS_PLAN_SET_AREA",
column: "AREA_ID");
migrationBuilder.CreateIndex(
name: "IX_T_BS_PLAN_SET_AREA_ORG_ID",
table: "T_BS_PLAN_SET_AREA",
column: "ORG_ID");
migrationBuilder.CreateIndex(
name: "IX_T_BS_PLAN_SET_AREA_PLANSET_ID",
table: "T_BS_PLAN_SET_AREA",
column: "PLANSET_ID");
migrationBuilder.CreateIndex(
name: "IX_T_BS_PLAN_SET_DEPARTMENT_OUT_DEPARTMENT_ID",
table: "T_BS_PLAN_SET_DEPARTMENT_OUT",
column: "DEPARTMENT_ID");
migrationBuilder.CreateIndex(
name: "IX_T_BS_PLAN_SET_DEPARTMENT_OUT_ORG_ID",
table: "T_BS_PLAN_SET_DEPARTMENT_OUT",
column: "ORG_ID");
migrationBuilder.CreateIndex(
name: "IX_T_BS_PLAN_SET_DEPARTMENT_OUT_PLANSET_ID",
table: "T_BS_PLAN_SET_DEPARTMENT_OUT",
column: "PLANSET_ID");
migrationBuilder.AddForeignKey(
name: "FK_T_BS_PLAN_SET_T_FM_USER_USER_ID_SEND",
table: "T_BS_PLAN_SET",
column: "USER_ID_SEND",
principalTable: "T_FM_USER",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_T_BS_PLAN_SET_T_FM_USER_USER_ID_SEND",
table: "T_BS_PLAN_SET");
migrationBuilder.DropTable(
name: "T_BS_PLAN_SET_AREA");
migrationBuilder.DropTable(
name: "T_BS_PLAN_SET_DEPARTMENT_OUT");
migrationBuilder.DropIndex(
name: "IX_T_BS_PLAN_SET_USER_ID_SEND",
table: "T_BS_PLAN_SET");
migrationBuilder.DropColumn(
name: "USER_ID_SEND",
table: "T_BS_PLAN_SET");
}
}
}