144 lines
		
	
	
		
			7.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			144 lines
		
	
	
		
			7.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using Microsoft.EntityFrameworkCore.Migrations;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace APT.Data.Migrations.Migrations
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class wjn2024012602 : Migration
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        protected override void Up(MigrationBuilder migrationBuilder)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropTable(
							 | 
						|||
| 
								 | 
							
								                name: "T_OG_OGCONFIG");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropTable(
							 | 
						|||
| 
								 | 
							
								                name: "T_OG_PERSONNEL_TYPE_ENUM");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropTable(
							 | 
						|||
| 
								 | 
							
								                name: "T_OG_STANDARDIZATION_REVIEW_RESULT_ENUM");
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected override void Down(MigrationBuilder migrationBuilder)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateTable(
							 | 
						|||
| 
								 | 
							
								                name: "T_OG_OGCONFIG",
							 | 
						|||
| 
								 | 
							
								                columns: table => new
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    CREATER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    CREATE_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    EMPLOYEE_OPINION_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    ENTITY_ORG_TPYE = table.Column<int>(type: "int", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    EVENT_GET_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    EVENT_GET_TIME_1 = table.Column<DateTime>(type: "datetime2", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    FLOW_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    FLOW_SEND_STATUS = table.Column<int>(type: "int", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    FLOW_STATUS = table.Column<int>(type: "int", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    FORM_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    IS_DELETED = table.Column<bool>(type: "bit", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    MODIFIER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    MODIFY_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    ORG_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    REPORT_SUM_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    SAFE_PDT_PERSONAL_SIGNED_TRIGGER_TIME = table.Column<DateTime>(type: "datetime2", nullable: true)
							 | 
						|||
| 
								 | 
							
								                },
							 | 
						|||
| 
								 | 
							
								                constraints: table =>
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    table.PrimaryKey("PK_T_OG_OGCONFIG", x => x.ID);
							 | 
						|||
| 
								 | 
							
								                    table.ForeignKey(
							 | 
						|||
| 
								 | 
							
								                        name: "FK_T_OG_OGCONFIG_T_FM_ORGANIZATION_ORG_ID",
							 | 
						|||
| 
								 | 
							
								                        column: x => x.ORG_ID,
							 | 
						|||
| 
								 | 
							
								                        principalTable: "T_FM_ORGANIZATION",
							 | 
						|||
| 
								 | 
							
								                        principalColumn: "ID",
							 | 
						|||
| 
								 | 
							
								                        onDelete: ReferentialAction.Restrict);
							 | 
						|||
| 
								 | 
							
								                });
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateTable(
							 | 
						|||
| 
								 | 
							
								                name: "T_OG_PERSONNEL_TYPE_ENUM",
							 | 
						|||
| 
								 | 
							
								                columns: table => new
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    CREATER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    CREATE_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    ENTITY_ORG_TPYE = table.Column<int>(type: "int", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    FLOW_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    FLOW_SEND_STATUS = table.Column<int>(type: "int", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    FLOW_STATUS = table.Column<int>(type: "int", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    FORM_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    IS_DELETED = table.Column<bool>(type: "bit", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    MODIFIER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    MODIFY_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    NAME = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
							 | 
						|||
| 
								 | 
							
								                    ORG_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
							 | 
						|||
| 
								 | 
							
								                },
							 | 
						|||
| 
								 | 
							
								                constraints: table =>
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    table.PrimaryKey("PK_T_OG_PERSONNEL_TYPE_ENUM", x => x.ID);
							 | 
						|||
| 
								 | 
							
								                    table.ForeignKey(
							 | 
						|||
| 
								 | 
							
								                        name: "FK_T_OG_PERSONNEL_TYPE_ENUM_T_FM_ORGANIZATION_ORG_ID",
							 | 
						|||
| 
								 | 
							
								                        column: x => x.ORG_ID,
							 | 
						|||
| 
								 | 
							
								                        principalTable: "T_FM_ORGANIZATION",
							 | 
						|||
| 
								 | 
							
								                        principalColumn: "ID",
							 | 
						|||
| 
								 | 
							
								                        onDelete: ReferentialAction.Restrict);
							 | 
						|||
| 
								 | 
							
								                });
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateTable(
							 | 
						|||
| 
								 | 
							
								                name: "T_OG_STANDARDIZATION_REVIEW_RESULT_ENUM",
							 | 
						|||
| 
								 | 
							
								                columns: table => new
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    CREATER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    CREATE_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    ENTITY_ORG_TPYE = table.Column<int>(type: "int", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    FLOW_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    FLOW_SEND_STATUS = table.Column<int>(type: "int", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    FLOW_STATUS = table.Column<int>(type: "int", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    FORM_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    IS_DELETED = table.Column<bool>(type: "bit", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    MODIFIER_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    MODIFY_TIME = table.Column<DateTime>(type: "datetime2", nullable: true),
							 | 
						|||
| 
								 | 
							
								                    NAME = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
							 | 
						|||
| 
								 | 
							
								                    ORG_ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
							 | 
						|||
| 
								 | 
							
								                },
							 | 
						|||
| 
								 | 
							
								                constraints: table =>
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    table.PrimaryKey("PK_T_OG_STANDARDIZATION_REVIEW_RESULT_ENUM", x => x.ID);
							 | 
						|||
| 
								 | 
							
								                    table.ForeignKey(
							 | 
						|||
| 
								 | 
							
								                        name: "FK_T_OG_STANDARDIZATION_REVIEW_RESULT_ENUM_T_FM_ORGANIZATION_ORG_ID",
							 | 
						|||
| 
								 | 
							
								                        column: x => x.ORG_ID,
							 | 
						|||
| 
								 | 
							
								                        principalTable: "T_FM_ORGANIZATION",
							 | 
						|||
| 
								 | 
							
								                        principalColumn: "ID",
							 | 
						|||
| 
								 | 
							
								                        onDelete: ReferentialAction.Restrict);
							 | 
						|||
| 
								 | 
							
								                });
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_OG_OGCONFIG_ORG_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_OG_OGCONFIG",
							 | 
						|||
| 
								 | 
							
								                column: "ORG_ID");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_OG_PERSONNEL_TYPE_ENUM_NAME",
							 | 
						|||
| 
								 | 
							
								                table: "T_OG_PERSONNEL_TYPE_ENUM",
							 | 
						|||
| 
								 | 
							
								                column: "NAME",
							 | 
						|||
| 
								 | 
							
								                unique: true,
							 | 
						|||
| 
								 | 
							
								                filter: "[NAME] IS NOT NULL");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_OG_PERSONNEL_TYPE_ENUM_ORG_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_OG_PERSONNEL_TYPE_ENUM",
							 | 
						|||
| 
								 | 
							
								                column: "ORG_ID");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_OG_STANDARDIZATION_REVIEW_RESULT_ENUM_NAME",
							 | 
						|||
| 
								 | 
							
								                table: "T_OG_STANDARDIZATION_REVIEW_RESULT_ENUM",
							 | 
						|||
| 
								 | 
							
								                column: "NAME",
							 | 
						|||
| 
								 | 
							
								                unique: true,
							 | 
						|||
| 
								 | 
							
								                filter: "[NAME] IS NOT NULL");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_OG_STANDARDIZATION_REVIEW_RESULT_ENUM_ORG_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_OG_STANDARDIZATION_REVIEW_RESULT_ENUM",
							 | 
						|||
| 
								 | 
							
								                column: "ORG_ID");
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |