using System; using Microsoft.EntityFrameworkCore.Migrations; namespace APT.Data.Migrations.Migrations { public partial class hmr2025111801 : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "PLACE", table: "T_FO_LEADER_WELL_RECORD", type: "nvarchar(50)", maxLength: 50, nullable: true); migrationBuilder.CreateTable( name: "T_FO_LEADER_WELL_RECORD_AFTERUSER", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), LEADER_WELL_RECORD_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_AFTERUSER", x => x.ID); table.ForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_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_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_AFTERUSER_T_FO_LEADER_WELL_RECORD_LEADER_WELL_RECORD_ID", column: x => x.LEADER_WELL_RECORD_ID, principalTable: "T_FO_LEADER_WELL_RECORD", principalColumn: "ID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateTable( name: "T_FO_LEADER_WELL_RECORD_PREUSER", columns: table => new { ID = table.Column(type: "uniqueidentifier", nullable: false), LEADER_WELL_RECORD_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_PREUSER", x => x.ID); table.ForeignKey( name: "FK_T_FO_LEADER_WELL_RECORD_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_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_PREUSER_T_FO_LEADER_WELL_RECORD_LEADER_WELL_RECORD_ID", column: x => x.LEADER_WELL_RECORD_ID, principalTable: "T_FO_LEADER_WELL_RECORD", principalColumn: "ID", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_AFTERUSER_AFTER_USER_ID", table: "T_FO_LEADER_WELL_RECORD_AFTERUSER", column: "AFTER_USER_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_AFTERUSER_LEADER_WELL_RECORD_ID", table: "T_FO_LEADER_WELL_RECORD_AFTERUSER", column: "LEADER_WELL_RECORD_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_AFTERUSER_ORG_ID", table: "T_FO_LEADER_WELL_RECORD_AFTERUSER", column: "ORG_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_PREUSER_LEADER_WELL_RECORD_ID", table: "T_FO_LEADER_WELL_RECORD_PREUSER", column: "LEADER_WELL_RECORD_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_PREUSER_ORG_ID", table: "T_FO_LEADER_WELL_RECORD_PREUSER", column: "ORG_ID"); migrationBuilder.CreateIndex( name: "IX_T_FO_LEADER_WELL_RECORD_PREUSER_PRE_USER_ID", table: "T_FO_LEADER_WELL_RECORD_PREUSER", column: "PRE_USER_ID"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "T_FO_LEADER_WELL_RECORD_AFTERUSER"); migrationBuilder.DropTable( name: "T_FO_LEADER_WELL_RECORD_PREUSER"); migrationBuilder.DropColumn( name: "PLACE", table: "T_FO_LEADER_WELL_RECORD"); } } }