using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace HHWMS.Web.Migrations { public partial class updatetaskmodel : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_ReceiptDetail_ReceiptHeader_HeaderId", table: "ReceiptDetail"); migrationBuilder.DropForeignKey( name: "FK_ShipmentDetail_ShipmentHeader_HeaderId", table: "ShipmentDetail"); migrationBuilder.DropForeignKey( name: "FK_TaskDetail_TaskHeader_HeaderId", table: "TaskDetail"); migrationBuilder.DropIndex( name: "IX_TaskDetail_HeaderId", table: "TaskDetail"); migrationBuilder.DropIndex( name: "IX_ShipmentDetail_HeaderId", table: "ShipmentDetail"); migrationBuilder.DropIndex( name: "IX_ReceiptDetail_HeaderId", table: "ReceiptDetail"); migrationBuilder.AlterColumn( name: "MaterialSpec", table: "TaskDetailHistory", type: "varchar(50)", maxLength: 50, nullable: true, comment: "物料规格", oldClrType: typeof(string), oldType: "longtext", oldNullable: true, oldComment: "物料规格") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "MaterialSpec", table: "TaskDetail", type: "varchar(50)", maxLength: 50, nullable: true, comment: "物料规格", oldClrType: typeof(string), oldType: "longtext", oldNullable: true, oldComment: "物料规格") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "ShipmentHeaderID", table: "ShipmentDetail", type: "int", nullable: true); migrationBuilder.AddColumn( name: "ReceiptHeaderID", table: "ReceiptDetail", type: "int", nullable: true); migrationBuilder.CreateIndex( name: "IX_TaskHeaderHistory_TaskNo", table: "TaskHeaderHistory", column: "TaskNo", unique: true); migrationBuilder.CreateIndex( name: "IX_ShipmentDetail_ShipmentHeaderID", table: "ShipmentDetail", column: "ShipmentHeaderID"); migrationBuilder.CreateIndex( name: "IX_ReceiptDetail_ReceiptHeaderID", table: "ReceiptDetail", column: "ReceiptHeaderID"); migrationBuilder.AddForeignKey( name: "FK_ReceiptDetail_ReceiptHeader_ReceiptHeaderID", table: "ReceiptDetail", column: "ReceiptHeaderID", principalTable: "ReceiptHeader", principalColumn: "ID"); migrationBuilder.AddForeignKey( name: "FK_ShipmentDetail_ShipmentHeader_ShipmentHeaderID", table: "ShipmentDetail", column: "ShipmentHeaderID", principalTable: "ShipmentHeader", principalColumn: "ID"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_ReceiptDetail_ReceiptHeader_ReceiptHeaderID", table: "ReceiptDetail"); migrationBuilder.DropForeignKey( name: "FK_ShipmentDetail_ShipmentHeader_ShipmentHeaderID", table: "ShipmentDetail"); migrationBuilder.DropIndex( name: "IX_TaskHeaderHistory_TaskNo", table: "TaskHeaderHistory"); migrationBuilder.DropIndex( name: "IX_ShipmentDetail_ShipmentHeaderID", table: "ShipmentDetail"); migrationBuilder.DropIndex( name: "IX_ReceiptDetail_ReceiptHeaderID", table: "ReceiptDetail"); migrationBuilder.DropColumn( name: "ShipmentHeaderID", table: "ShipmentDetail"); migrationBuilder.DropColumn( name: "ReceiptHeaderID", table: "ReceiptDetail"); migrationBuilder.AlterColumn( name: "MaterialSpec", table: "TaskDetailHistory", type: "longtext", nullable: true, comment: "物料规格", oldClrType: typeof(string), oldType: "varchar(50)", oldMaxLength: 50, oldNullable: true, oldComment: "物料规格") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "MaterialSpec", table: "TaskDetail", type: "longtext", nullable: true, comment: "物料规格", oldClrType: typeof(string), oldType: "varchar(50)", oldMaxLength: 50, oldNullable: true, oldComment: "物料规格") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_TaskDetail_HeaderId", table: "TaskDetail", column: "HeaderId"); migrationBuilder.CreateIndex( name: "IX_ShipmentDetail_HeaderId", table: "ShipmentDetail", column: "HeaderId"); migrationBuilder.CreateIndex( name: "IX_ReceiptDetail_HeaderId", table: "ReceiptDetail", column: "HeaderId"); migrationBuilder.AddForeignKey( name: "FK_ReceiptDetail_ReceiptHeader_HeaderId", table: "ReceiptDetail", column: "HeaderId", principalTable: "ReceiptHeader", principalColumn: "ID", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_ShipmentDetail_ShipmentHeader_HeaderId", table: "ShipmentDetail", column: "HeaderId", principalTable: "ShipmentHeader", principalColumn: "ID", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_TaskDetail_TaskHeader_HeaderId", table: "TaskDetail", column: "HeaderId", principalTable: "TaskHeader", principalColumn: "ID", onDelete: ReferentialAction.Cascade); } } }