From c8c04c357dcafc1804ff360f4bdd2c6e52160b31 Mon Sep 17 00:00:00 2001 From: "Kalana B. Thilakarathna" Date: Fri, 18 Sep 2026 12:18:00 +0530 Subject: [PATCH] refactor plan created --- ...17034841_RefactorSalesToShopPOAndInvoice.cs | 18 +----------------- .../docs/refactor_docs/refactor_plan.md | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/Distribution/Migrations/20260917034841_RefactorSalesToShopPOAndInvoice.cs b/Distribution/Migrations/20260917034841_RefactorSalesToShopPOAndInvoice.cs index a312656..468488d 100644 --- a/Distribution/Migrations/20260917034841_RefactorSalesToShopPOAndInvoice.cs +++ b/Distribution/Migrations/20260917034841_RefactorSalesToShopPOAndInvoice.cs @@ -898,23 +898,7 @@ namespace Distribution.Migrations private static void DropForeignKeyIfExists(MigrationBuilder migrationBuilder, string tableName, string constraintName) { - migrationBuilder.Sql($""" - SET @sql = IF( - EXISTS( - SELECT 1 - FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS - WHERE CONSTRAINT_SCHEMA = DATABASE() - AND TABLE_NAME = '{tableName}' - AND CONSTRAINT_NAME = '{constraintName}' - AND CONSTRAINT_TYPE = 'FOREIGN KEY' - ), - 'ALTER TABLE `{tableName}` DROP FOREIGN KEY `{constraintName}`', - 'SELECT 1' - ); - PREPARE stmt FROM @sql; - EXECUTE stmt; - DEALLOCATE PREPARE stmt; - """); + migrationBuilder.Sql($"ALTER TABLE `{tableName}` DROP FOREIGN KEY IF EXISTS `{constraintName}`;"); } private static void DropIndexIfExists(MigrationBuilder migrationBuilder, string tableName, string indexName) diff --git a/Distribution/docs/refactor_docs/refactor_plan.md b/Distribution/docs/refactor_docs/refactor_plan.md index e648038..49bf499 100644 --- a/Distribution/docs/refactor_docs/refactor_plan.md +++ b/Distribution/docs/refactor_docs/refactor_plan.md @@ -1,8 +1,23 @@ # Refactor Implementation Plan -**Status**: Ready to implement +**Status**: Implementation complete — migration pending (see Phase 5) **Design docs**: [order_invoice_lifecycle.md](./order_invoice_lifecycle.md), [loading_event.md](./loading_event.md), [dispatch_pipeline.md](./dispatch_pipeline.md), [ride_lifecycle.md](./ride_lifecycle.md) +| Phase | Title | Status | +|-------|-------|--------| +| 1 | Enums | ✅ Done | +| 2 | Remove Sale | ✅ Done | +| 3 | Model Changes | ✅ Done | +| 4 | DbContext | ✅ Done | +| 5 | Migration | ⚠️ Migration created — `dotnet ef database update` failing (FK drop error — fix applied 2026-09-17) | +| 6 | Invoice Feature | ✅ Done (GET list/detail only; create/print/finalize endpoints pending) | +| 7 | ShopPO Feature | ✅ Done (GET list/detail only; confirm/cancel/items endpoints pending) | +| 8 | Payment Feature | ✅ Done | +| 9 | LoadingEvent Overhaul | ✅ Done | +| 10 | Ride Overhaul | ✅ Done | +| 11 | SysConfig + InvoiceCreationMode | ✅ Done (replaces original Program.cs/appsettings plan; implemented as DB-backed key-value store) | +| 12 | Permission Seeding | ⏳ Pending | + --- ## Scope