using System; using Microsoft.EntityFrameworkCore.Migrations; namespace APT.Data.Migrations.Migrations { public partial class hmr2025111101 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_DETAIL_T_FM_USER_AFTER_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL"); migrationBuilder.DropForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_DETAIL_T_FM_USER_PRE_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL"); migrationBuilder.DropIndex( name: "IX_T_FO_LEADER_WELL_RECORD_DETAIL_AFTER_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL"); migrationBuilder.DropIndex( name: "IX_T_FO_LEADER_WELL_RECORD_DETAIL_PRE_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL"); migrationBuilder.DropColumn( name: "AFTER_USER_DEAL_STATUS", table: "T_FO_LEADER_WELL_RECORD_DETAIL"); migrationBuilder.DropColumn( name: "AFTER_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL"); migrationBuilder.DropColumn( name: "PRE_USER_DEAL_STATUS", table: "T_FO_LEADER_WELL_RECORD_DETAIL"); migrationBuilder.DropColumn( name: "PRE_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL"); migrationBuilder.AddColumn( name: "AREA_ID", table: "T_SK_CHECK_SET_CONTENTS", type: "uniqueidentifier", nullable: true); migrationBuilder.AddColumn( name: "ENTERPRISE_LIBRARY_DETAIL_ID", table: "T_SK_CHECK_SET_CONTENTS", type: "uniqueidentifier", nullable: true); migrationBuilder.AddColumn( name: "ENTERPRISE_LIBRARY_ID", table: "T_SK_CHECK_SET_CONTENTS", type: "uniqueidentifier", nullable: true); migrationBuilder.AddColumn( name: "MEASURES_NAME", table: "T_SK_CHECK_SET_CONTENTS", type: "nvarchar(300)", maxLength: 300, nullable: true); migrationBuilder.AddColumn( name: "RISK_NAME", table: "T_SK_CHECK_SET_CONTENTS", type: "nvarchar(50)", maxLength: 50, nullable: true); migrationBuilder.AddColumn( name: "POST_NAME", table: "T_SK_CHECK_SET", type: "nvarchar(50)", maxLength: 50, nullable: true); migrationBuilder.CreateTable( name: "T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), LEADER_WELL_RECORD_DETAIL_ID = table.Column(type: "uniqueidentifier", nullable: false), AFTER_USER_ID = table.Column(type: "uniqueidentifier", nullable: true), AFTER_USER_DEAL_STATUS = table.Column(type: "int", 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_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER", x => x.ID); table.ForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER_T_FM_ORGANIZATION_ORG_ID", column: x => x.ORG_ID, principalTable: "T_FM_ORGANIZATION", principalColumn: "ID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER_T_FM_USER_AFTER_USER_ID", column: x => x.AFTER_USER_ID, principalTable: "T_FM_USER", principalColumn: "ID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER_T_FO_LEADER_WELL_RECORD_DETAIL_LEADER_WELL_RECORD_DETAIL_ID", column: x => x.LEADER_WELL_RECORD_DETAIL_ID, principalTable: "T_FO_LEADER_WELL_RECORD_DETAIL", principalColumn: "ID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), LEADER_WELL_RECORD_DETAIL_ID = table.Column(type: "uniqueidentifier", nullable: false), PRE_USER_ID = table.Column(type: "uniqueidentifier", nullable: true), PRE_USER_DEAL_STATUS = table.Column(type: "int", 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_FO_LEADER_WELL_RECORD_DETAIL_PREUSER", x => x.ID); table.ForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER_T_FM_ORGANIZATION_ORG_ID", column: x => x.ORG_ID, principalTable: "T_FM_ORGANIZATION", principalColumn: "ID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER_T_FM_USER_PRE_USER_ID", column: x => x.PRE_USER_ID, principalTable: "T_FM_USER", principalColumn: "ID", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER_T_FO_LEADER_WELL_RECORD_DETAIL_LEADER_WELL_RECORD_DETAIL_ID", column: x => x.LEADER_WELL_RECORD_DETAIL_ID, principalTable: "T_FO_LEADER_WELL_RECORD_DETAIL", principalColumn: "ID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_T_SK_CHECK_SET_CONTENTS_AREA_ID", table: "T_SK_CHECK_SET_CONTENTS", column: "AREA_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER_AFTER_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER", column: "AFTER_USER_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER_LEADER_WELL_RECORD_DETAIL_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER", column: "LEADER_WELL_RECORD_DETAIL_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER_ORG_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER", column: "ORG_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER_LEADER_WELL_RECORD_DETAIL_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER", column: "LEADER_WELL_RECORD_DETAIL_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER_ORG_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER", column: "ORG_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER_PRE_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER", column: "PRE_USER_ID"); migrationBuilder.AddForeignKey( name: "FK_T_SK_CHECK_SET_CONTENTS_T_SK_RISK_AREA_AREA_ID", table: "T_SK_CHECK_SET_CONTENTS", column: "AREA_ID", principalTable: "T_SK_RISK_AREA", principalColumn: "ID", onDelete: ReferentialAction.Restrict); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_T_SK_CHECK_SET_CONTENTS_T_SK_RISK_AREA_AREA_ID", table: "T_SK_CHECK_SET_CONTENTS"); migrationBuilder.DropTable( name: "T_FO_LEADER_WELL_RECORD_DETAIL_AFTERUSER"); migrationBuilder.DropTable( name: "T_FO_LEADER_WELL_RECORD_DETAIL_PREUSER"); migrationBuilder.DropIndex( name: "IX_T_SK_CHECK_SET_CONTENTS_AREA_ID", table: "T_SK_CHECK_SET_CONTENTS"); migrationBuilder.DropColumn( name: "AREA_ID", table: "T_SK_CHECK_SET_CONTENTS"); migrationBuilder.DropColumn( name: "ENTERPRISE_LIBRARY_DETAIL_ID", table: "T_SK_CHECK_SET_CONTENTS"); migrationBuilder.DropColumn( name: "ENTERPRISE_LIBRARY_ID", table: "T_SK_CHECK_SET_CONTENTS"); migrationBuilder.DropColumn( name: "MEASURES_NAME", table: "T_SK_CHECK_SET_CONTENTS"); migrationBuilder.DropColumn( name: "RISK_NAME", table: "T_SK_CHECK_SET_CONTENTS"); migrationBuilder.DropColumn( name: "POST_NAME", table: "T_SK_CHECK_SET"); migrationBuilder.AddColumn( name: "AFTER_USER_DEAL_STATUS", table: "T_FO_LEADER_WELL_RECORD_DETAIL", type: "int", nullable: true); migrationBuilder.AddColumn( name: "AFTER_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL", type: "uniqueidentifier", nullable: true); migrationBuilder.AddColumn( name: "PRE_USER_DEAL_STATUS", table: "T_FO_LEADER_WELL_RECORD_DETAIL", type: "int", nullable: true); migrationBuilder.AddColumn( name: "PRE_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL", type: "uniqueidentifier", nullable: true); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_DETAIL_AFTER_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL", column: "AFTER_USER_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_DETAIL_PRE_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL", column: "PRE_USER_ID"); migrationBuilder.AddForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_DETAIL_T_FM_USER_AFTER_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL", column: "AFTER_USER_ID", principalTable: "T_FM_USER", principalColumn: "ID", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_DETAIL_T_FM_USER_PRE_USER_ID", table: "T_FO_LEADER_WELL_RECORD_DETAIL", column: "PRE_USER_ID", principalTable: "T_FM_USER", principalColumn: "ID", onDelete: ReferentialAction.Restrict); } } }