127 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			127 lines
		
	
	
		
			5.9 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using Microsoft.EntityFrameworkCore.Migrations;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace APT.Data.Migrations.Migrations
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class wyw2024042401 : Migration
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        protected override void Up(MigrationBuilder migrationBuilder)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropForeignKey(
							 | 
						|||
| 
								 | 
							
								                name: "FK_T_CM_DRILL_PLAN_STANDARD_CREATE_T_CM_DRILL_PLAN_DETAIL_PLAN_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_PLAN_STANDARD_CREATE");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_CM_DRILL_PLAN_STANDARD_CREATE_PLAN_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_PLAN_STANDARD_CREATE");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.AddColumn<Guid>(
							 | 
						|||
| 
								 | 
							
								                name: "Nav_PlanID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_PLAN_STANDARD_CREATE",
							 | 
						|||
| 
								 | 
							
								                type: "uniqueidentifier",
							 | 
						|||
| 
								 | 
							
								                nullable: true);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateTable(
							 | 
						|||
| 
								 | 
							
								                name: "T_CM_DRILL_RECORD_STANDER_FILE",
							 | 
						|||
| 
								 | 
							
								                columns: table => new
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    ID = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
							 | 
						|||
| 
								 | 
							
								                    RECORD_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_CM_DRILL_RECORD_STANDER_FILE", x => x.ID);
							 | 
						|||
| 
								 | 
							
								                    table.ForeignKey(
							 | 
						|||
| 
								 | 
							
								                        name: "FK_T_CM_DRILL_RECORD_STANDER_FILE_T_CM_DRILL_RECORD_RECORD_ID",
							 | 
						|||
| 
								 | 
							
								                        column: x => x.RECORD_ID,
							 | 
						|||
| 
								 | 
							
								                        principalTable: "T_CM_DRILL_RECORD",
							 | 
						|||
| 
								 | 
							
								                        principalColumn: "ID",
							 | 
						|||
| 
								 | 
							
								                        onDelete: ReferentialAction.Restrict);
							 | 
						|||
| 
								 | 
							
								                    table.ForeignKey(
							 | 
						|||
| 
								 | 
							
								                        name: "FK_T_CM_DRILL_RECORD_STANDER_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_CM_DRILL_RECORD_STANDER_FILE_T_PF_IMG_FILE_IMG_FILE_ID",
							 | 
						|||
| 
								 | 
							
								                        column: x => x.IMG_FILE_ID,
							 | 
						|||
| 
								 | 
							
								                        principalTable: "T_PF_IMG_FILE",
							 | 
						|||
| 
								 | 
							
								                        principalColumn: "ID",
							 | 
						|||
| 
								 | 
							
								                        onDelete: ReferentialAction.Restrict);
							 | 
						|||
| 
								 | 
							
								                });
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_CM_DRILL_PLAN_STANDARD_CREATE_Nav_PlanID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_PLAN_STANDARD_CREATE",
							 | 
						|||
| 
								 | 
							
								                column: "Nav_PlanID");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_CM_DRILL_RECORD_STANDER_FILE_IMG_FILE_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_RECORD_STANDER_FILE",
							 | 
						|||
| 
								 | 
							
								                column: "IMG_FILE_ID");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_CM_DRILL_RECORD_STANDER_FILE_ORG_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_RECORD_STANDER_FILE",
							 | 
						|||
| 
								 | 
							
								                column: "ORG_ID");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_CM_DRILL_RECORD_STANDER_FILE_RECORD_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_RECORD_STANDER_FILE",
							 | 
						|||
| 
								 | 
							
								                column: "RECORD_ID");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.AddForeignKey(
							 | 
						|||
| 
								 | 
							
								                name: "FK_T_CM_DRILL_PLAN_STANDARD_CREATE_T_CM_DRILL_PLAN_DETAIL_Nav_PlanID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_PLAN_STANDARD_CREATE",
							 | 
						|||
| 
								 | 
							
								                column: "Nav_PlanID",
							 | 
						|||
| 
								 | 
							
								                principalTable: "T_CM_DRILL_PLAN_DETAIL",
							 | 
						|||
| 
								 | 
							
								                principalColumn: "ID",
							 | 
						|||
| 
								 | 
							
								                onDelete: ReferentialAction.Restrict);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected override void Down(MigrationBuilder migrationBuilder)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropForeignKey(
							 | 
						|||
| 
								 | 
							
								                name: "FK_T_CM_DRILL_PLAN_STANDARD_CREATE_T_CM_DRILL_PLAN_DETAIL_Nav_PlanID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_PLAN_STANDARD_CREATE");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropTable(
							 | 
						|||
| 
								 | 
							
								                name: "T_CM_DRILL_RECORD_STANDER_FILE");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_CM_DRILL_PLAN_STANDARD_CREATE_Nav_PlanID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_PLAN_STANDARD_CREATE");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropColumn(
							 | 
						|||
| 
								 | 
							
								                name: "Nav_PlanID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_PLAN_STANDARD_CREATE");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_CM_DRILL_PLAN_STANDARD_CREATE_PLAN_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_PLAN_STANDARD_CREATE",
							 | 
						|||
| 
								 | 
							
								                column: "PLAN_ID");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.AddForeignKey(
							 | 
						|||
| 
								 | 
							
								                name: "FK_T_CM_DRILL_PLAN_STANDARD_CREATE_T_CM_DRILL_PLAN_DETAIL_PLAN_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_CM_DRILL_PLAN_STANDARD_CREATE",
							 | 
						|||
| 
								 | 
							
								                column: "PLAN_ID",
							 | 
						|||
| 
								 | 
							
								                principalTable: "T_CM_DRILL_PLAN_DETAIL",
							 | 
						|||
| 
								 | 
							
								                principalColumn: "ID",
							 | 
						|||
| 
								 | 
							
								                onDelete: ReferentialAction.Restrict);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |