using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Distribution.Migrations { /// public partial class AddSupplierClaims : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "SupplierClaims", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), FK_PurchaseOrderId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), FK_GoodsReceiptId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), Details = table.Column(type: "longtext", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), EvidenceUrl = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), Status = table.Column(type: "int", nullable: false), ResolutionType = table.Column(type: "int", nullable: true), ResolutionAmount = table.Column(type: "decimal(65,30)", nullable: true), ResolutionNotes = table.Column(type: "longtext", nullable: true) .Annotation("MySql:CharSet", "utf8mb4"), RaisedByUserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), ResolvedByUserId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), ResolvedAt = table.Column(type: "datetime(6)", nullable: true), CreatedAt = table.Column(type: "datetime(6)", nullable: false), IsActive = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SupplierClaims", x => x.Id); table.ForeignKey( name: "FK_SupplierClaims_GoodsReceipts_FK_GoodsReceiptId", column: x => x.FK_GoodsReceiptId, principalTable: "GoodsReceipts", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_SupplierClaims_PurchaseOrders_FK_PurchaseOrderId", column: x => x.FK_PurchaseOrderId, principalTable: "PurchaseOrders", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_SupplierClaims_Users_RaisedByUserId", column: x => x.RaisedByUserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_SupplierClaims_Users_ResolvedByUserId", column: x => x.ResolvedByUserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "SupplierClaimItems", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), FK_SupplierClaimId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), FK_ItemId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Quantity = table.Column(type: "decimal(65,30)", nullable: false), IssueType = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime(6)", nullable: false), IsActive = table.Column(type: "tinyint(1)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_SupplierClaimItems", x => x.Id); table.ForeignKey( name: "FK_SupplierClaimItems_Items_FK_ItemId", column: x => x.FK_ItemId, principalTable: "Items", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_SupplierClaimItems_SupplierClaims_FK_SupplierClaimId", column: x => x.FK_SupplierClaimId, principalTable: "SupplierClaims", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_SupplierClaimItems_FK_ItemId", table: "SupplierClaimItems", column: "FK_ItemId"); migrationBuilder.CreateIndex( name: "IX_SupplierClaimItems_FK_SupplierClaimId", table: "SupplierClaimItems", column: "FK_SupplierClaimId"); migrationBuilder.CreateIndex( name: "IX_SupplierClaims_FK_GoodsReceiptId", table: "SupplierClaims", column: "FK_GoodsReceiptId"); migrationBuilder.CreateIndex( name: "IX_SupplierClaims_FK_PurchaseOrderId", table: "SupplierClaims", column: "FK_PurchaseOrderId"); migrationBuilder.CreateIndex( name: "IX_SupplierClaims_RaisedByUserId", table: "SupplierClaims", column: "RaisedByUserId"); migrationBuilder.CreateIndex( name: "IX_SupplierClaims_ResolvedByUserId", table: "SupplierClaims", column: "ResolvedByUserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "SupplierClaimItems"); migrationBuilder.DropTable( name: "SupplierClaims"); } } }