serial numbers
This commit is contained in:
+9481
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,635 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ERPCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddItemTrackingSerialsWarranty : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BinId",
|
||||
table: "serials",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "CreatedAt",
|
||||
table: "serials",
|
||||
type: "datetime(6)",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "GrnLineId",
|
||||
table: "serials",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "ReceivedAt",
|
||||
table: "serials",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<uint>(
|
||||
name: "RowVersion",
|
||||
table: "serials",
|
||||
type: "int unsigned",
|
||||
nullable: false,
|
||||
defaultValue: 0u);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "UpdatedAt",
|
||||
table: "serials",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "WarehouseId",
|
||||
table: "serials",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "WarrantyPeriodMonths",
|
||||
table: "serials",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BatchId",
|
||||
table: "sales_return_lines",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BatchId",
|
||||
table: "sales_invoice_lines",
|
||||
type: "int",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "grn_line_serials",
|
||||
columns: table => new
|
||||
{
|
||||
GrnLineSerialId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
GrnLineId = table.Column<int>(type: "int", nullable: false),
|
||||
SerialNo = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, collation: "utf8mb4_unicode_ci"),
|
||||
SerialId = table.Column<int>(type: "int", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_grn_line_serials", x => x.GrnLineSerialId);
|
||||
table.ForeignKey(
|
||||
name: "FK_grn_line_serials_grn_lines_GrnLineId",
|
||||
column: x => x.GrnLineId,
|
||||
principalTable: "grn_lines",
|
||||
principalColumn: "GrnLineId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_grn_line_serials_serials_SerialId",
|
||||
column: x => x.SerialId,
|
||||
principalTable: "serials",
|
||||
principalColumn: "SerialId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("Relational:Collation", "utf8mb4_unicode_ci");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "sales_invoice_line_serials",
|
||||
columns: table => new
|
||||
{
|
||||
SalesInvoiceLineSerialId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
SalesInvoiceLineId = table.Column<int>(type: "int", nullable: false),
|
||||
SerialId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_sales_invoice_line_serials", x => x.SalesInvoiceLineSerialId);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_invoice_line_serials_sales_invoice_lines_SalesInvoiceL~",
|
||||
column: x => x.SalesInvoiceLineId,
|
||||
principalTable: "sales_invoice_lines",
|
||||
principalColumn: "SalesInvoiceLineId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_invoice_line_serials_serials_SerialId",
|
||||
column: x => x.SerialId,
|
||||
principalTable: "serials",
|
||||
principalColumn: "SerialId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("Relational:Collation", "utf8mb4_unicode_ci");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "sales_line_allocations",
|
||||
columns: table => new
|
||||
{
|
||||
SalesLineAllocationId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
SourceDocType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"),
|
||||
SourceDocId = table.Column<int>(type: "int", nullable: false),
|
||||
SourceLineId = table.Column<int>(type: "int", nullable: false),
|
||||
ItemId = table.Column<int>(type: "int", nullable: false),
|
||||
WarehouseId = table.Column<int>(type: "int", nullable: false),
|
||||
BatchId = table.Column<int>(type: "int", nullable: true),
|
||||
SerialId = table.Column<int>(type: "int", nullable: true),
|
||||
Qty = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false),
|
||||
UnitCost = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: false),
|
||||
QtyReturned = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_sales_line_allocations", x => x.SalesLineAllocationId);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_line_allocations_batches_BatchId",
|
||||
column: x => x.BatchId,
|
||||
principalTable: "batches",
|
||||
principalColumn: "BatchId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_line_allocations_serials_SerialId",
|
||||
column: x => x.SerialId,
|
||||
principalTable: "serials",
|
||||
principalColumn: "SerialId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("Relational:Collation", "utf8mb4_unicode_ci");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "sales_return_line_serials",
|
||||
columns: table => new
|
||||
{
|
||||
SalesReturnLineSerialId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ReturnLineId = table.Column<int>(type: "int", nullable: false),
|
||||
SerialId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_sales_return_line_serials", x => x.SalesReturnLineSerialId);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_return_line_serials_sales_return_lines_ReturnLineId",
|
||||
column: x => x.ReturnLineId,
|
||||
principalTable: "sales_return_lines",
|
||||
principalColumn: "ReturnLineId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_return_line_serials_serials_SerialId",
|
||||
column: x => x.SerialId,
|
||||
principalTable: "serials",
|
||||
principalColumn: "SerialId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("Relational:Collation", "utf8mb4_unicode_ci");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "sales_slip_line_serials",
|
||||
columns: table => new
|
||||
{
|
||||
SalesSlipLineSerialId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
SalesSlipLineId = table.Column<int>(type: "int", nullable: false),
|
||||
SerialId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_sales_slip_line_serials", x => x.SalesSlipLineSerialId);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_slip_line_serials_sales_slip_lines_SalesSlipLineId",
|
||||
column: x => x.SalesSlipLineId,
|
||||
principalTable: "sales_slip_lines",
|
||||
principalColumn: "SalesSlipLineId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_sales_slip_line_serials_serials_SerialId",
|
||||
column: x => x.SerialId,
|
||||
principalTable: "serials",
|
||||
principalColumn: "SerialId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("Relational:Collation", "utf8mb4_unicode_ci");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "serial_movements",
|
||||
columns: table => new
|
||||
{
|
||||
SerialMovementId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
SerialId = table.Column<int>(type: "int", nullable: false),
|
||||
SourceDocType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"),
|
||||
SourceDocId = table.Column<int>(type: "int", nullable: false),
|
||||
Status = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"),
|
||||
FromWarehouseId = table.Column<int>(type: "int", nullable: true),
|
||||
WarehouseId = table.Column<int>(type: "int", nullable: true),
|
||||
UserId = table.Column<int>(type: "int", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_serial_movements", x => x.SerialMovementId);
|
||||
table.ForeignKey(
|
||||
name: "FK_serial_movements_serials_SerialId",
|
||||
column: x => x.SerialId,
|
||||
principalTable: "serials",
|
||||
principalColumn: "SerialId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("Relational:Collation", "utf8mb4_unicode_ci");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "stock_transfer_line_serials",
|
||||
columns: table => new
|
||||
{
|
||||
StockTransferLineSerialId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
TransferLineId = table.Column<int>(type: "int", nullable: false),
|
||||
SerialId = table.Column<int>(type: "int", nullable: false),
|
||||
BatchId = table.Column<int>(type: "int", nullable: true),
|
||||
UnitCost = table.Column<decimal>(type: "decimal(18,6)", precision: 18, scale: 6, nullable: true),
|
||||
ReceivedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_stock_transfer_line_serials", x => x.StockTransferLineSerialId);
|
||||
table.ForeignKey(
|
||||
name: "FK_stock_transfer_line_serials_batches_BatchId",
|
||||
column: x => x.BatchId,
|
||||
principalTable: "batches",
|
||||
principalColumn: "BatchId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_stock_transfer_line_serials_serials_SerialId",
|
||||
column: x => x.SerialId,
|
||||
principalTable: "serials",
|
||||
principalColumn: "SerialId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_stock_transfer_line_serials_stock_transfer_lines_TransferLin~",
|
||||
column: x => x.TransferLineId,
|
||||
principalTable: "stock_transfer_lines",
|
||||
principalColumn: "TransferLineId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
})
|
||||
.Annotation("Relational:Collation", "utf8mb4_unicode_ci");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "warranty_registrations",
|
||||
columns: table => new
|
||||
{
|
||||
WarrantyRegistrationId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
||||
ItemId = table.Column<int>(type: "int", nullable: false),
|
||||
SerialId = table.Column<int>(type: "int", nullable: true),
|
||||
CustomerId = table.Column<int>(type: "int", nullable: false),
|
||||
SourceDocType = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false, collation: "utf8mb4_unicode_ci"),
|
||||
SourceDocId = table.Column<int>(type: "int", nullable: false),
|
||||
SourceLineId = table.Column<int>(type: "int", nullable: false),
|
||||
Qty = table.Column<decimal>(type: "decimal(18,4)", precision: 18, scale: 4, nullable: false),
|
||||
StartDate = table.Column<DateOnly>(type: "date", nullable: false),
|
||||
PeriodMonths = table.Column<int>(type: "int", nullable: false),
|
||||
EndDate = table.Column<DateOnly>(type: "date", nullable: false),
|
||||
Status = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false, collation: "utf8mb4_unicode_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true),
|
||||
RowVersion = table.Column<uint>(type: "int unsigned", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_warranty_registrations", x => x.WarrantyRegistrationId);
|
||||
table.ForeignKey(
|
||||
name: "FK_warranty_registrations_customers_CustomerId",
|
||||
column: x => x.CustomerId,
|
||||
principalTable: "customers",
|
||||
principalColumn: "CustomerId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_warranty_registrations_items_ItemId",
|
||||
column: x => x.ItemId,
|
||||
principalTable: "items",
|
||||
principalColumn: "ItemId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
table.ForeignKey(
|
||||
name: "FK_warranty_registrations_serials_SerialId",
|
||||
column: x => x.SerialId,
|
||||
principalTable: "serials",
|
||||
principalColumn: "SerialId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
})
|
||||
.Annotation("Relational:Collation", "utf8mb4_unicode_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_serials_BinId",
|
||||
table: "serials",
|
||||
column: "BinId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_serials_GrnLineId",
|
||||
table: "serials",
|
||||
column: "GrnLineId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_serials_ItemId_Status",
|
||||
table: "serials",
|
||||
columns: new[] { "ItemId", "Status" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_serials_WarehouseId_ItemId_Status",
|
||||
table: "serials",
|
||||
columns: new[] { "WarehouseId", "ItemId", "Status" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_return_lines_BatchId",
|
||||
table: "sales_return_lines",
|
||||
column: "BatchId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_invoice_lines_BatchId",
|
||||
table: "sales_invoice_lines",
|
||||
column: "BatchId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_grn_line_serials_GrnLineId_SerialNo",
|
||||
table: "grn_line_serials",
|
||||
columns: new[] { "GrnLineId", "SerialNo" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_grn_line_serials_SerialId",
|
||||
table: "grn_line_serials",
|
||||
column: "SerialId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_invoice_line_serials_SalesInvoiceLineId_SerialId",
|
||||
table: "sales_invoice_line_serials",
|
||||
columns: new[] { "SalesInvoiceLineId", "SerialId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_invoice_line_serials_SerialId",
|
||||
table: "sales_invoice_line_serials",
|
||||
column: "SerialId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_line_allocations_BatchId",
|
||||
table: "sales_line_allocations",
|
||||
column: "BatchId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_line_allocations_SerialId",
|
||||
table: "sales_line_allocations",
|
||||
column: "SerialId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_line_allocations_SourceDocType_SourceDocId_SourceLineId",
|
||||
table: "sales_line_allocations",
|
||||
columns: new[] { "SourceDocType", "SourceDocId", "SourceLineId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_return_line_serials_ReturnLineId_SerialId",
|
||||
table: "sales_return_line_serials",
|
||||
columns: new[] { "ReturnLineId", "SerialId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_return_line_serials_SerialId",
|
||||
table: "sales_return_line_serials",
|
||||
column: "SerialId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_slip_line_serials_SalesSlipLineId_SerialId",
|
||||
table: "sales_slip_line_serials",
|
||||
columns: new[] { "SalesSlipLineId", "SerialId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_sales_slip_line_serials_SerialId",
|
||||
table: "sales_slip_line_serials",
|
||||
column: "SerialId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_serial_movements_SerialId_SerialMovementId",
|
||||
table: "serial_movements",
|
||||
columns: new[] { "SerialId", "SerialMovementId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_serial_movements_SourceDocType_SourceDocId",
|
||||
table: "serial_movements",
|
||||
columns: new[] { "SourceDocType", "SourceDocId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_stock_transfer_line_serials_BatchId",
|
||||
table: "stock_transfer_line_serials",
|
||||
column: "BatchId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_stock_transfer_line_serials_SerialId",
|
||||
table: "stock_transfer_line_serials",
|
||||
column: "SerialId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_stock_transfer_line_serials_TransferLineId_SerialId",
|
||||
table: "stock_transfer_line_serials",
|
||||
columns: new[] { "TransferLineId", "SerialId" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_warranty_registrations_CustomerId",
|
||||
table: "warranty_registrations",
|
||||
column: "CustomerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_warranty_registrations_ItemId",
|
||||
table: "warranty_registrations",
|
||||
column: "ItemId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_warranty_registrations_SerialId",
|
||||
table: "warranty_registrations",
|
||||
column: "SerialId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_warranty_registrations_SourceDocType_SourceDocId",
|
||||
table: "warranty_registrations",
|
||||
columns: new[] { "SourceDocType", "SourceDocId" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_warranty_registrations_Status_EndDate",
|
||||
table: "warranty_registrations",
|
||||
columns: new[] { "Status", "EndDate" });
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_sales_invoice_lines_batches_BatchId",
|
||||
table: "sales_invoice_lines",
|
||||
column: "BatchId",
|
||||
principalTable: "batches",
|
||||
principalColumn: "BatchId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_sales_return_lines_batches_BatchId",
|
||||
table: "sales_return_lines",
|
||||
column: "BatchId",
|
||||
principalTable: "batches",
|
||||
principalColumn: "BatchId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_serials_bins_BinId",
|
||||
table: "serials",
|
||||
column: "BinId",
|
||||
principalTable: "bins",
|
||||
principalColumn: "BinId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_serials_grn_lines_GrnLineId",
|
||||
table: "serials",
|
||||
column: "GrnLineId",
|
||||
principalTable: "grn_lines",
|
||||
principalColumn: "GrnLineId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_serials_warehouses_WarehouseId",
|
||||
table: "serials",
|
||||
column: "WarehouseId",
|
||||
principalTable: "warehouses",
|
||||
principalColumn: "WarehouseId",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
// Backfill serial rows that predate this migration: a real CreatedAt, a live
|
||||
// concurrency token (0 is never live — see ErpDbContext.BumpRowVersions), and the
|
||||
// warehouse of an in-stock serial's own open layer, if it has one.
|
||||
migrationBuilder.Sql("""
|
||||
UPDATE `serials` SET `CreatedAt` = UTC_TIMESTAMP(6) WHERE `CreatedAt` < '1900-01-01';
|
||||
UPDATE `serials` SET `RowVersion` = 1 WHERE `RowVersion` = 0;
|
||||
UPDATE `serials` s
|
||||
JOIN `stock_layers` l ON l.`SerialId` = s.`SerialId` AND l.`QtyRemaining` > 0
|
||||
SET s.`WarehouseId` = l.`WarehouseId`
|
||||
WHERE s.`Status` = 'InStock' AND s.`WarehouseId` IS NULL;
|
||||
""");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_sales_invoice_lines_batches_BatchId",
|
||||
table: "sales_invoice_lines");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_sales_return_lines_batches_BatchId",
|
||||
table: "sales_return_lines");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_serials_bins_BinId",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_serials_grn_lines_GrnLineId",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_serials_warehouses_WarehouseId",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "grn_line_serials");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "sales_invoice_line_serials");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "sales_line_allocations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "sales_return_line_serials");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "sales_slip_line_serials");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "serial_movements");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "stock_transfer_line_serials");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "warranty_registrations");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_serials_BinId",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_serials_GrnLineId",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_serials_ItemId_Status",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_serials_WarehouseId_ItemId_Status",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_sales_return_lines_BatchId",
|
||||
table: "sales_return_lines");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_sales_invoice_lines_BatchId",
|
||||
table: "sales_invoice_lines");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BinId",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CreatedAt",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GrnLineId",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ReceivedAt",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RowVersion",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UpdatedAt",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WarehouseId",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WarrantyPeriodMonths",
|
||||
table: "serials");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BatchId",
|
||||
table: "sales_return_lines");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BatchId",
|
||||
table: "sales_invoice_lines");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1693,6 +1693,35 @@ namespace ERPCore.Migrations
|
||||
b.ToTable("grn_lines", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineSerial", b =>
|
||||
{
|
||||
b.Property<int>("GrnLineSerialId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("GrnLineSerialId"));
|
||||
|
||||
b.Property<int>("GrnLineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("SerialId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SerialNo")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.HasKey("GrnLineSerialId");
|
||||
|
||||
b.HasIndex("SerialId");
|
||||
|
||||
b.HasIndex("GrnLineId", "SerialNo")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("grn_line_serials", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b =>
|
||||
{
|
||||
b.Property<int>("GrnLineWarrantyNumberId")
|
||||
@@ -4740,6 +4769,9 @@ namespace ERPCore.Migrations
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int?>("BatchId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
@@ -4810,6 +4842,8 @@ namespace ERPCore.Migrations
|
||||
|
||||
b.HasKey("SalesInvoiceLineId");
|
||||
|
||||
b.HasIndex("BatchId");
|
||||
|
||||
b.HasIndex("ItemId");
|
||||
|
||||
b.HasIndex("SalesInvoiceId");
|
||||
@@ -4819,6 +4853,30 @@ namespace ERPCore.Migrations
|
||||
b.ToTable("sales_invoice_lines", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLineSerial", b =>
|
||||
{
|
||||
b.Property<int>("SalesInvoiceLineSerialId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SalesInvoiceLineSerialId"));
|
||||
|
||||
b.Property<int>("SalesInvoiceLineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SerialId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("SalesInvoiceLineSerialId");
|
||||
|
||||
b.HasIndex("SerialId");
|
||||
|
||||
b.HasIndex("SalesInvoiceLineId", "SerialId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("sales_invoice_line_serials", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b =>
|
||||
{
|
||||
b.Property<int>("SalesInvoicePaymentId")
|
||||
@@ -4868,6 +4926,63 @@ namespace ERPCore.Migrations
|
||||
b.ToTable("sales_invoice_payments", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesLineAllocation", b =>
|
||||
{
|
||||
b.Property<int>("SalesLineAllocationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SalesLineAllocationId"));
|
||||
|
||||
b.Property<int?>("BatchId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("ItemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("Qty")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<decimal>("QtyReturned")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<int?>("SerialId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SourceDocId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SourceDocType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<int>("SourceLineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("UnitCost")
|
||||
.HasPrecision(18, 6)
|
||||
.HasColumnType("decimal(18,6)");
|
||||
|
||||
b.Property<int>("WarehouseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("SalesLineAllocationId");
|
||||
|
||||
b.HasIndex("BatchId");
|
||||
|
||||
b.HasIndex("SerialId");
|
||||
|
||||
b.HasIndex("SourceDocType", "SourceDocId", "SourceLineId");
|
||||
|
||||
b.ToTable("sales_line_allocations", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b =>
|
||||
{
|
||||
b.Property<int>("ReturnId")
|
||||
@@ -4932,6 +5047,9 @@ namespace ERPCore.Migrations
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("ReturnLineId"));
|
||||
|
||||
b.Property<int?>("BatchId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ItemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
@@ -4947,6 +5065,8 @@ namespace ERPCore.Migrations
|
||||
|
||||
b.HasKey("ReturnLineId");
|
||||
|
||||
b.HasIndex("BatchId");
|
||||
|
||||
b.HasIndex("ItemId");
|
||||
|
||||
b.HasIndex("ReturnId");
|
||||
@@ -4956,6 +5076,30 @@ namespace ERPCore.Migrations
|
||||
b.ToTable("sales_return_lines", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLineSerial", b =>
|
||||
{
|
||||
b.Property<int>("SalesReturnLineSerialId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SalesReturnLineSerialId"));
|
||||
|
||||
b.Property<int>("ReturnLineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SerialId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("SalesReturnLineSerialId");
|
||||
|
||||
b.HasIndex("SerialId");
|
||||
|
||||
b.HasIndex("ReturnLineId", "SerialId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("sales_return_line_serials", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b =>
|
||||
{
|
||||
b.Property<int>("SalesSlipId")
|
||||
@@ -5151,6 +5295,30 @@ namespace ERPCore.Migrations
|
||||
b.ToTable("sales_slip_lines", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLineSerial", b =>
|
||||
{
|
||||
b.Property<int>("SalesSlipLineSerialId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SalesSlipLineSerialId"));
|
||||
|
||||
b.Property<int>("SalesSlipLineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SerialId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("SalesSlipLineSerialId");
|
||||
|
||||
b.HasIndex("SerialId");
|
||||
|
||||
b.HasIndex("SalesSlipLineId", "SerialId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("sales_slip_line_serials", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b =>
|
||||
{
|
||||
b.Property<int>("SerialId")
|
||||
@@ -5163,9 +5331,25 @@ namespace ERPCore.Migrations
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("varchar(100)");
|
||||
|
||||
b.Property<int?>("BinId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int?>("GrnLineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ItemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ReceivedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<uint>("RowVersion")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("int unsigned");
|
||||
|
||||
b.Property<string>("SerialNo")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
@@ -5176,17 +5360,79 @@ namespace ERPCore.Migrations
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<DateTime?>("UpdatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int?>("WarehouseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("WarrantyPeriodMonths")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("SerialId");
|
||||
|
||||
b.HasIndex("Barcode")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("BinId");
|
||||
|
||||
b.HasIndex("GrnLineId");
|
||||
|
||||
b.HasIndex("ItemId", "SerialNo")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ItemId", "Status");
|
||||
|
||||
b.HasIndex("WarehouseId", "ItemId", "Status");
|
||||
|
||||
b.ToTable("serials", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SerialMovement", b =>
|
||||
{
|
||||
b.Property<int>("SerialMovementId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("SerialMovementId"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int?>("FromWarehouseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SerialId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SourceDocId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SourceDocType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("WarehouseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("SerialMovementId");
|
||||
|
||||
b.HasIndex("SerialId", "SerialMovementId");
|
||||
|
||||
b.HasIndex("SourceDocType", "SourceDocId");
|
||||
|
||||
b.ToTable("serial_movements", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b =>
|
||||
{
|
||||
b.Property<int>("EdgeId")
|
||||
@@ -5744,6 +5990,42 @@ namespace ERPCore.Migrations
|
||||
b.ToTable("stock_transfer_lines", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLineSerial", b =>
|
||||
{
|
||||
b.Property<int>("StockTransferLineSerialId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("StockTransferLineSerialId"));
|
||||
|
||||
b.Property<int?>("BatchId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("ReceivedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("SerialId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TransferLineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal?>("UnitCost")
|
||||
.HasPrecision(18, 6)
|
||||
.HasColumnType("decimal(18,6)");
|
||||
|
||||
b.HasKey("StockTransferLineSerialId");
|
||||
|
||||
b.HasIndex("BatchId");
|
||||
|
||||
b.HasIndex("SerialId");
|
||||
|
||||
b.HasIndex("TransferLineId", "SerialId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("stock_transfer_line_serials", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b =>
|
||||
{
|
||||
b.Property<int>("SubCategoryId")
|
||||
@@ -6787,6 +7069,77 @@ namespace ERPCore.Migrations
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyRegistration", b =>
|
||||
{
|
||||
b.Property<int>("WarrantyRegistrationId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("WarrantyRegistrationId"));
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<int>("CustomerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateOnly>("EndDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<int>("ItemId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PeriodMonths")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<decimal>("Qty")
|
||||
.HasPrecision(18, 4)
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<uint>("RowVersion")
|
||||
.IsConcurrencyToken()
|
||||
.HasColumnType("int unsigned");
|
||||
|
||||
b.Property<int?>("SerialId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SourceDocId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SourceDocType")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("varchar(50)");
|
||||
|
||||
b.Property<int>("SourceLineId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateOnly>("StartDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("varchar(20)");
|
||||
|
||||
b.Property<DateTime?>("UpdatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("WarrantyRegistrationId");
|
||||
|
||||
b.HasIndex("CustomerId");
|
||||
|
||||
b.HasIndex("ItemId");
|
||||
|
||||
b.HasIndex("SerialId");
|
||||
|
||||
b.HasIndex("SourceDocType", "SourceDocId");
|
||||
|
||||
b.HasIndex("Status", "EndDate");
|
||||
|
||||
b.ToTable("warranty_registrations", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.WorkShift", b =>
|
||||
{
|
||||
b.Property<int>("WorkShiftId")
|
||||
@@ -7306,6 +7659,24 @@ namespace ERPCore.Migrations
|
||||
b.Navigation("PoLine");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineSerial", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine")
|
||||
.WithMany("Serials")
|
||||
.HasForeignKey("GrnLineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Serial", "Serial")
|
||||
.WithMany()
|
||||
.HasForeignKey("SerialId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("GrnLine");
|
||||
|
||||
b.Navigation("Serial");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.GrnLineWarrantyNumber", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine")
|
||||
@@ -8143,6 +8514,11 @@ namespace ERPCore.Migrations
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.Batch", "Batch")
|
||||
.WithMany()
|
||||
.HasForeignKey("BatchId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Item", "Item")
|
||||
.WithMany()
|
||||
.HasForeignKey("ItemId")
|
||||
@@ -8161,6 +8537,8 @@ namespace ERPCore.Migrations
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Batch");
|
||||
|
||||
b.Navigation("Item");
|
||||
|
||||
b.Navigation("SalesInvoice");
|
||||
@@ -8168,6 +8546,25 @@ namespace ERPCore.Migrations
|
||||
b.Navigation("Warehouse");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLineSerial", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.SalesInvoiceLine", "SalesInvoiceLine")
|
||||
.WithMany("Serials")
|
||||
.HasForeignKey("SalesInvoiceLineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Serial", "Serial")
|
||||
.WithMany()
|
||||
.HasForeignKey("SerialId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("SalesInvoiceLine");
|
||||
|
||||
b.Navigation("Serial");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoicePayment", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.User", "Creator")
|
||||
@@ -8187,6 +8584,23 @@ namespace ERPCore.Migrations
|
||||
b.Navigation("SalesInvoice");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesLineAllocation", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.Batch", "Batch")
|
||||
.WithMany()
|
||||
.HasForeignKey("BatchId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Serial", "Serial")
|
||||
.WithMany()
|
||||
.HasForeignKey("SerialId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Batch");
|
||||
|
||||
b.Navigation("Serial");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.User", "Creator")
|
||||
@@ -8224,6 +8638,11 @@ namespace ERPCore.Migrations
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.Batch", "Batch")
|
||||
.WithMany()
|
||||
.HasForeignKey("BatchId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Item", "Item")
|
||||
.WithMany()
|
||||
.HasForeignKey("ItemId")
|
||||
@@ -8241,6 +8660,8 @@ namespace ERPCore.Migrations
|
||||
.HasForeignKey("SalesInvoiceLineId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Batch");
|
||||
|
||||
b.Navigation("Item");
|
||||
|
||||
b.Navigation("Return");
|
||||
@@ -8248,6 +8669,25 @@ namespace ERPCore.Migrations
|
||||
b.Navigation("SalesInvoiceLine");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLineSerial", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.SalesReturnLine", "ReturnLine")
|
||||
.WithMany("Serials")
|
||||
.HasForeignKey("ReturnLineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Serial", "Serial")
|
||||
.WithMany()
|
||||
.HasForeignKey("SerialId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ReturnLine");
|
||||
|
||||
b.Navigation("Serial");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.User", "CashierUser")
|
||||
@@ -8323,15 +8763,66 @@ namespace ERPCore.Migrations
|
||||
b.Navigation("Warehouse");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLineSerial", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.SalesSlipLine", "SalesSlipLine")
|
||||
.WithMany("Serials")
|
||||
.HasForeignKey("SalesSlipLineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Serial", "Serial")
|
||||
.WithMany()
|
||||
.HasForeignKey("SerialId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("SalesSlipLine");
|
||||
|
||||
b.Navigation("Serial");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.Serial", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.Bin", "Bin")
|
||||
.WithMany()
|
||||
.HasForeignKey("BinId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.GrnLine", "GrnLine")
|
||||
.WithMany()
|
||||
.HasForeignKey("GrnLineId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Item", "Item")
|
||||
.WithMany()
|
||||
.HasForeignKey("ItemId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Warehouse", "Warehouse")
|
||||
.WithMany()
|
||||
.HasForeignKey("WarehouseId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Bin");
|
||||
|
||||
b.Navigation("GrnLine");
|
||||
|
||||
b.Navigation("Item");
|
||||
|
||||
b.Navigation("Warehouse");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SerialMovement", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.Serial", "Serial")
|
||||
.WithMany()
|
||||
.HasForeignKey("SerialId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Serial");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.StageEdge", b =>
|
||||
@@ -8470,7 +8961,7 @@ namespace ERPCore.Migrations
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Serial", null)
|
||||
b.HasOne("ERPCore.Domain.Entities.Serial", "Serial")
|
||||
.WithMany()
|
||||
.HasForeignKey("SerialId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
@@ -8478,6 +8969,8 @@ namespace ERPCore.Migrations
|
||||
b.Navigation("Adjustment");
|
||||
|
||||
b.Navigation("Item");
|
||||
|
||||
b.Navigation("Serial");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.StockCount", b =>
|
||||
@@ -8695,6 +9188,30 @@ namespace ERPCore.Migrations
|
||||
b.Navigation("Transfer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLineSerial", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.Batch", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("BatchId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Serial", "Serial")
|
||||
.WithMany()
|
||||
.HasForeignKey("SerialId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.StockTransferLine", "TransferLine")
|
||||
.WithMany("Serials")
|
||||
.HasForeignKey("TransferLineId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Serial");
|
||||
|
||||
b.Navigation("TransferLine");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SubCategory", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.Category", "Category")
|
||||
@@ -8809,6 +9326,32 @@ namespace ERPCore.Migrations
|
||||
b.Navigation("Branch");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.WarrantyRegistration", b =>
|
||||
{
|
||||
b.HasOne("ERPCore.Domain.Entities.Customer", "Customer")
|
||||
.WithMany()
|
||||
.HasForeignKey("CustomerId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Item", "Item")
|
||||
.WithMany()
|
||||
.HasForeignKey("ItemId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("ERPCore.Domain.Entities.Serial", "Serial")
|
||||
.WithMany()
|
||||
.HasForeignKey("SerialId")
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Customer");
|
||||
|
||||
b.Navigation("Item");
|
||||
|
||||
b.Navigation("Serial");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.BundleSale", b =>
|
||||
{
|
||||
b.Navigation("Lines");
|
||||
@@ -8841,6 +9384,8 @@ namespace ERPCore.Migrations
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.GrnLine", b =>
|
||||
{
|
||||
b.Navigation("Serials");
|
||||
|
||||
b.Navigation("WarrantyNumbers");
|
||||
});
|
||||
|
||||
@@ -8944,16 +9489,31 @@ namespace ERPCore.Migrations
|
||||
b.Navigation("Payments");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesInvoiceLine", b =>
|
||||
{
|
||||
b.Navigation("Serials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturn", b =>
|
||||
{
|
||||
b.Navigation("Lines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesReturnLine", b =>
|
||||
{
|
||||
b.Navigation("Serials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlip", b =>
|
||||
{
|
||||
b.Navigation("Lines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SalesSlipLine", b =>
|
||||
{
|
||||
b.Navigation("Serials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.StockAdjustment", b =>
|
||||
{
|
||||
b.Navigation("Lines");
|
||||
@@ -8969,6 +9529,11 @@ namespace ERPCore.Migrations
|
||||
b.Navigation("Lines");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.StockTransferLine", b =>
|
||||
{
|
||||
b.Navigation("Serials");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ERPCore.Domain.Entities.SupportTicket", b =>
|
||||
{
|
||||
b.Navigation("Messages");
|
||||
|
||||
Reference in New Issue
Block a user