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(type: "uniqueidentifier", nullable: false), PLAN_ID = table.Column(type: "uniqueidentifier", nullable: true), TYPE = table.Column(type: "int", nullable: false), YEAR = table.Column(type: "int", nullable: false), LAUNCH_TIME = table.Column(type: "datetime2", nullable: false), END_TIME = table.Column(type: "datetime2", nullable: true), DEPARTMENT_ID = table.Column(type: "uniqueidentifier", nullable: true), LAUNCH_USER_ID = table.Column(type: "uniqueidentifier", nullable: true), PLAN_NAME = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), GUIDE_PRINCIPLE = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), TRAIN_REQUIREMENT = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), PERSENT = table.Column(type: "decimal(18,2)", nullable: true), STATUS = table.Column(type: "int", nullable: false), IS_DELETED = table.Column(type: "bit", nullable: false), ORG_ID = table.Column(type: "uniqueidentifier", nullable: false), ENTITY_ORG_TPYE = table.Column(type: "int", nullable: false), FORM_ID = table.Column(type: "uniqueidentifier", nullable: true), FLOW_STATUS = table.Column(type: "int", nullable: false), FLOW_SEND_STATUS = table.Column(type: "int", nullable: false), FLOW_ID = table.Column(type: "uniqueidentifier", nullable: true), CREATE_TIME = table.Column(type: "datetime2", nullable: true), MODIFY_TIME = table.Column(type: "datetime2", nullable: true), CREATER_ID = table.Column(type: "uniqueidentifier", nullable: true), MODIFIER_ID = table.Column(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(type: "uniqueidentifier", nullable: false), PLAN_ID = table.Column(type: "uniqueidentifier", nullable: false), PLAN_DETAIL_ID = table.Column(type: "uniqueidentifier", nullable: true), DATE_TRAIN = table.Column(type: "datetime2", nullable: false), IN_OUT = table.Column(type: "int", nullable: false), TYPE_ID = table.Column(type: "uniqueidentifier", nullable: true), NAME = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), OBJECT = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), TRAINTYPE = table.Column(type: "int", nullable: false), CHECKTYPE = table.Column(type: "int", nullable: false), CLASSHOUR = table.Column(type: "int", nullable: false), SPRINTTYPE = table.Column(type: "int", nullable: false), ISALL = table.Column(type: "bit", nullable: false), DEPARTMENT_ID = table.Column(type: "uniqueidentifier", nullable: true), STATUS = table.Column(type: "int", nullable: false), IS_DELETED = table.Column(type: "bit", nullable: false), ORG_ID = table.Column(type: "uniqueidentifier", nullable: false), ENTITY_ORG_TPYE = table.Column(type: "int", nullable: false), FORM_ID = table.Column(type: "uniqueidentifier", nullable: true), FLOW_STATUS = table.Column(type: "int", nullable: false), FLOW_SEND_STATUS = table.Column(type: "int", nullable: false), FLOW_ID = table.Column(type: "uniqueidentifier", nullable: true), CREATE_TIME = table.Column(type: "datetime2", nullable: true), MODIFY_TIME = table.Column(type: "datetime2", nullable: true), CREATER_ID = table.Column(type: "uniqueidentifier", nullable: true), MODIFIER_ID = table.Column(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(type: "uniqueidentifier", nullable: false), PLAN_ID = table.Column(type: "uniqueidentifier", nullable: false), IMG_FILE_ID = table.Column(type: "uniqueidentifier", nullable: false), IS_DELETED = table.Column(type: "bit", nullable: false), ORG_ID = table.Column(type: "uniqueidentifier", nullable: false), ENTITY_ORG_TPYE = table.Column(type: "int", nullable: false), FORM_ID = table.Column(type: "uniqueidentifier", nullable: true), FLOW_STATUS = table.Column(type: "int", nullable: false), FLOW_SEND_STATUS = table.Column(type: "int", nullable: false), FLOW_ID = table.Column(type: "uniqueidentifier", nullable: true), CREATE_TIME = table.Column(type: "datetime2", nullable: true), MODIFY_TIME = table.Column(type: "datetime2", nullable: true), CREATER_ID = table.Column(type: "uniqueidentifier", nullable: true), MODIFIER_ID = table.Column(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(type: "uniqueidentifier", nullable: false), PLAN_DETAIL_ID = table.Column(type: "uniqueidentifier", nullable: false), DEPARTMENT_ID = table.Column(type: "uniqueidentifier", nullable: true), IS_DELETED = table.Column(type: "bit", nullable: false), ORG_ID = table.Column(type: "uniqueidentifier", nullable: false), ENTITY_ORG_TPYE = table.Column(type: "int", nullable: false), FORM_ID = table.Column(type: "uniqueidentifier", nullable: true), FLOW_STATUS = table.Column(type: "int", nullable: false), FLOW_SEND_STATUS = table.Column(type: "int", nullable: false), FLOW_ID = table.Column(type: "uniqueidentifier", nullable: true), CREATE_TIME = table.Column(type: "datetime2", nullable: true), MODIFY_TIME = table.Column(type: "datetime2", nullable: true), CREATER_ID = table.Column(type: "uniqueidentifier", nullable: true), MODIFIER_ID = table.Column(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"); } } }