Files
jdescopingtool/openspec/changes/archive/2026-01-01-migrate-database-schema/tasks.md
T
Joseph Doherty 26ff8d9b4f Initial commit: JDE Scoping Tool migration project
Set up repository with legacy .NET Framework 4.8 source (OLD/),
new .NET 10 Blazor solution (NEW/), OpenSpec specifications,
documentation, and project configuration.
2026-01-02 07:43:29 -05:00

10 KiB

Tasks: Migrate Database Schema

Phase 0: Foundation Tables (Corrected)

  • 001: Search table migration script

    • Source: OLD/Database/Tables/Search.sql
    • Note: Corrected to match legacy schema (ID, UserName, Name, Status, SubmitDT, StartDT, EndDT, Criteria, Results)
    • Location: NEW/src/JdeScoping.Database/Scripts/001_CreateSearchTable.sql
  • 002: DataUpdate table migration script

    • Source: OLD/Database/Tables/DataUpdate.sql
    • Note: Corrected to match legacy schema (SourceSystem, SourceData, TableName, StartDT, EndDT, UpdateType, WasSuccessful, NumberRecords)
    • Location: NEW/src/JdeScoping.Database/Scripts/002_CreateDataUpdateTable.sql

Phase 1: Reference Tables (No Dependencies)

  • 003: Create Branch table migration script

    • Source: OLD/Database/Tables/Branch.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/003_CreateBranchTable.sql
  • 004: Create StatusCode table migration script

    • Source: OLD/Database/Tables/StatusCode.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/004_CreateStatusCodeTable.sql
  • 005: Create FunctionCode table migration script

    • Source: OLD/Database/Tables/FunctionCode.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/005_CreateFunctionCodeTable.sql
  • 006: Create ProfitCenter table migration script

    • Source: OLD/Database/Tables/ProfitCenter.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/006_CreateProfitCenterTable.sql
  • 007: Create WorkCenter table migration script

    • Source: OLD/Database/Tables/WorkCenter.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/007_CreateWorkCenterTable.sql
  • 008: Create Item table migration script

    • Source: OLD/Database/Tables/Item.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/008_CreateItemTable.sql
  • 009: Create JdeUser table migration script

    • Source: OLD/Database/Tables/JdeUser.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/009_CreateJdeUserTable.sql
  • 010: Create OrgHierarchy table migration script

    • Source: OLD/Database/Tables/OrgHierarchy.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/010_CreateOrgHierarchyTable.sql
  • 011: Create RouteMaster table migration script

    • Source: OLD/Database/Tables/RouteMaster.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/011_CreateRouteMasterTable.sql
  • 012: Create MisData table migration script

    • Source: OLD/Database/Tables/MisData.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/012_CreateMisDataTable.sql

Phase 2: Core Tables (Depend on Reference Tables)

  • 013: Create Lot table migration script

    • Source: OLD/Database/Tables/Lot.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/013_CreateLotTable.sql
  • 014: Create LotLocation table migration script

    • Source: OLD/Database/Tables/LotLocation.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/014_CreateLotLocationTable.sql
  • 015: Create WorkOrder_Curr table migration script

    • Source: OLD/Database/Tables/WorkOrder_Curr.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/015_CreateWorkOrderCurrTable.sql
  • 016: Create WorkOrder_Hist table migration script

    • Source: OLD/Database/Tables/WorkOrder_Hist.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/016_CreateWorkOrderHistTable.sql
  • 017: Create WorkOrderStep_Curr table migration script

    • Source: OLD/Database/Tables/WorkOrderStep_Curr.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/017_CreateWorkOrderStepCurrTable.sql
  • 018: Create WorkOrderStep_Hist table migration script

    • Source: OLD/Database/Tables/WorkOrderStep_Hist.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/018_CreateWorkOrderStepHistTable.sql
  • 019: Create WorkOrderTime_Curr table migration script

    • Source: OLD/Database/Tables/WorkOrderTime_Curr.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/019_CreateWorkOrderTimeCurrTable.sql
  • 020: Create WorkOrderTime_Hist table migration script

    • Source: OLD/Database/Tables/WorkOrderTime_Hist.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/020_CreateWorkOrderTimeHistTable.sql
  • 021: Create WorkOrderComponent_Curr table migration script

    • Source: OLD/Database/Tables/WorkOrderComponent_Curr.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/021_CreateWorkOrderComponentCurrTable.sql
  • 022: Create WorkOrderComponent_Hist table migration script

    • Source: OLD/Database/Tables/WorkOrderComponent_Hist.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/022_CreateWorkOrderComponentHistTable.sql
  • 023: Create WorkOrderRouting table migration script

    • Source: OLD/Database/Tables/WorkOrderRouting_Curr.sql
    • Note: File creates dbo.WorkOrderRouting (no _Curr suffix, single table)
    • Location: NEW/src/JdeScoping.Database/Scripts/023_CreateWorkOrderRoutingTable.sql
  • 024: Create LotUsage_Curr table migration script

    • Source: OLD/Database/Tables/LotUsage_Curr.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/024_CreateLotUsageCurrTable.sql
  • 025: Create LotUsage_Hist table migration script

    • Source: OLD/Database/Tables/LotUsage_Hist.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/025_CreateLotUsageHistTable.sql

Phase 3: Views (Depend on Tables)

  • 026: Create WorkOrder view migration script

    • Source: OLD/Database/Views/WorkOrder.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/026_CreateWorkOrderView.sql
  • 027: Create WorkOrderTime view migration script

    • Source: OLD/Database/Views/WorkOrderTime.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/027_CreateWorkOrderTimeView.sql
  • 028: Create WorkOrderStep view migration script

    • Source: OLD/Database/Views/WorkOrderStep.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/028_CreateWorkOrderStepView.sql
  • 029: Create WorkOrderComponent view migration script

    • Source: OLD/Database/Views/WorkOrderComponent.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/029_CreateWorkOrderComponentView.sql
  • 030: Create LotUsage view migration script

    • Source: OLD/Database/Views/LotUsage.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/030_CreateLotUsageView.sql
  • 031: Create WorkOrderTotalScrap view migration script

    • Source: OLD/Database/Views/WorkOrderTotalScrap.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/031_CreateWorkOrderTotalScrapView.sql
  • 032: Create LastDataUpdates view migration script

    • Source: OLD/Database/Views/LastDataUpdates.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/032_CreateLastDataUpdatesView.sql

Phase 4: Table-Valued Parameter Types

  • 033: Create WorkOrderFilterParameter type migration script

    • Source: OLD/Database/Types/WorkOrderFilterParameter.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/033_CreateWorkOrderFilterParameterType.sql
  • 034: Create ItemNumberFilterParameter type migration script

    • Source: OLD/Database/Types/ItemNumberFilterParameter.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/034_CreateItemNumberFilterParameterType.sql
  • 035: Create ProfitCenterFilterParameter type migration script

    • Source: OLD/Database/Types/ProfitCenterFilterParameter.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/035_CreateProfitCenterFilterParameterType.sql
  • 036: Create WorkCenterFilterParameter type migration script

    • Source: OLD/Database/Types/WorkCenterFilterParameter.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/036_CreateWorkCenterFilterParameterType.sql
  • 037: Create OperatorFilterParameter type migration script

    • Source: OLD/Database/Types/OperatorFilterParameter.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/037_CreateOperatorFilterParameterType.sql
  • 038: Create ComponentLotFilterParameter type migration script

    • Source: OLD/Database/Types/ComponentLotFilterParameter.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/038_CreateComponentLotFilterParameterType.sql
  • 039: Create ItemOperationMisFilterParameter type migration script

    • Source: OLD/Database/Types/ItemOperationMISFilterParameter.sql
    • Note: Using lowercase "Mis" per Codex review naming convention
    • Location: NEW/src/JdeScoping.Database/Scripts/039_CreateItemOperationMisFilterParameterType.sql

Phase 5: Stored Procedures

  • 040: Create SubmitSearch stored procedure migration script

    • Source: OLD/Database/StoredProcedures/SubmitSearch.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/040_CreateSubmitSearchProcedure.sql
  • 041: Create StartSearch stored procedure migration script

    • Source: OLD/Database/StoredProcedures/StartSearch.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/041_CreateStartSearchProcedure.sql
  • 042: Create CompleteSearch stored procedure migration script

    • Source: OLD/Database/StoredProcedures/CompleteSearch.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/042_CreateCompleteSearchProcedure.sql
  • 043: Create ResetPartialSearches stored procedure migration script

    • Source: OLD/Database/StoredProcedures/ResetPartialSearches.sql
    • Location: NEW/src/JdeScoping.Database/Scripts/043_CreateResetPartialSearchesProcedure.sql

Phase 6: Functions

  • 044: Create MatchMis table-valued function migration script
    • Source: OLD/Database/Functions/MatchMis.sql
    • Dependencies: Item, WorkOrder, WorkOrderRouting, RouteMaster, MisData tables
    • Location: NEW/src/JdeScoping.Database/Scripts/044_CreateMatchMisFunction.sql

Phase 7: Verification

  • 045: Run full migration against clean database

    • Validation: All 44 scripts executed in order without error
    • Command: dotnet run --project NEW/src/JdeScoping.Host
  • 046: Verify all objects exist

    • Validation: Query sys.tables, sys.views, sys.procedures, sys.types
    • Results: 26 tables (25 + SchemaVersions), 7 views, 7 types, 4 procedures, 1 function
  • 047: Codex MCP review of migration scripts

    • All scripts verified against legacy source during creation
    • DATETIME -> DATETIME2(7) conversion applied consistently