68 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
		
		
			
		
	
	
			68 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using Microsoft.EntityFrameworkCore.Migrations;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace APT.Data.Migrations.Migrations
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class wjn2024071902 : Migration
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        protected override void Up(MigrationBuilder migrationBuilder)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.AddColumn<bool>(
							 | 
						|||
| 
								 | 
							
								                name: "IS_LEAF",
							 | 
						|||
| 
								 | 
							
								                table: "T_HM_RISK_AREA",
							 | 
						|||
| 
								 | 
							
								                type: "bit",
							 | 
						|||
| 
								 | 
							
								                nullable: false,
							 | 
						|||
| 
								 | 
							
								                defaultValue: false);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.AddColumn<Guid>(
							 | 
						|||
| 
								 | 
							
								                name: "PARENT_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_HM_RISK_AREA",
							 | 
						|||
| 
								 | 
							
								                type: "uniqueidentifier",
							 | 
						|||
| 
								 | 
							
								                nullable: true);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.AddColumn<string>(
							 | 
						|||
| 
								 | 
							
								                name: "TEXT",
							 | 
						|||
| 
								 | 
							
								                table: "T_HM_RISK_AREA",
							 | 
						|||
| 
								 | 
							
								                type: "nvarchar(50)",
							 | 
						|||
| 
								 | 
							
								                maxLength: 50,
							 | 
						|||
| 
								 | 
							
								                nullable: true);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.CreateIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_HM_RISK_AREA_PARENT_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_HM_RISK_AREA",
							 | 
						|||
| 
								 | 
							
								                column: "PARENT_ID");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.AddForeignKey(
							 | 
						|||
| 
								 | 
							
								                name: "FK_T_HM_RISK_AREA_T_HM_RISK_AREA_PARENT_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_HM_RISK_AREA",
							 | 
						|||
| 
								 | 
							
								                column: "PARENT_ID",
							 | 
						|||
| 
								 | 
							
								                principalTable: "T_HM_RISK_AREA",
							 | 
						|||
| 
								 | 
							
								                principalColumn: "ID",
							 | 
						|||
| 
								 | 
							
								                onDelete: ReferentialAction.Restrict);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        protected override void Down(MigrationBuilder migrationBuilder)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropForeignKey(
							 | 
						|||
| 
								 | 
							
								                name: "FK_T_HM_RISK_AREA_T_HM_RISK_AREA_PARENT_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_HM_RISK_AREA");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropIndex(
							 | 
						|||
| 
								 | 
							
								                name: "IX_T_HM_RISK_AREA_PARENT_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_HM_RISK_AREA");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropColumn(
							 | 
						|||
| 
								 | 
							
								                name: "IS_LEAF",
							 | 
						|||
| 
								 | 
							
								                table: "T_HM_RISK_AREA");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropColumn(
							 | 
						|||
| 
								 | 
							
								                name: "PARENT_ID",
							 | 
						|||
| 
								 | 
							
								                table: "T_HM_RISK_AREA");
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            migrationBuilder.DropColumn(
							 | 
						|||
| 
								 | 
							
								                name: "TEXT",
							 | 
						|||
| 
								 | 
							
								                table: "T_HM_RISK_AREA");
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |