docs: update documentation for extraction functions migration
- Add ExtractionFunctions.md reference document - Update database-schema spec with 11 extraction functions - Update data-access spec to document extraction function approach - Update search-processing spec with new query builder interface - Add Database.Tests to Testing.md architecture doc - Update DataFlow.md with extraction function flow
This commit is contained in:
@@ -121,7 +121,7 @@ The scoping tool cache database includes these primary tables:
|
||||
|
||||
| Table | Purpose |
|
||||
|-------|---------|
|
||||
| `Search` | User search requests, status, and results (Excel as VARBINARY) |
|
||||
| `Search` | User search requests, status, criteria (JSON), and results (Excel as VARBINARY) |
|
||||
| `DataUpdate` | Tracks last sync timestamp per data type |
|
||||
| `WorkOrder_Curr` | Current work orders from JDE |
|
||||
| `WorkOrder_Hist` | Historical work orders from JDE |
|
||||
@@ -134,6 +134,38 @@ The scoping tool cache database includes these primary tables:
|
||||
| `ProfitCenter` | Profit center reference data |
|
||||
| `SchemaVersions` | DbUp tracking table (auto-created) |
|
||||
|
||||
## Search Criteria Extraction Functions
|
||||
|
||||
The database includes SQL functions that extract filter criteria from the `Search.Criteria` JSON column. These functions enable the query builder to pass only a `SearchId` parameter, with all filter extraction happening in SQL Server.
|
||||
|
||||
### Scalar Functions (3)
|
||||
|
||||
| Function | Returns | Extracts |
|
||||
|----------|---------|----------|
|
||||
| `fn_GetSearchMinimumDt` | DATETIME2 | `$.MinimumDt` |
|
||||
| `fn_GetSearchMaximumDt` | DATETIME2 | `$.MaximumDt` |
|
||||
| `fn_GetSearchExtractMisData` | BIT | `$.ExtractMisData` |
|
||||
|
||||
### Table-Valued Functions (8)
|
||||
|
||||
| Function | Returns | Extracts |
|
||||
|----------|---------|----------|
|
||||
| `fn_GetSearchWorkOrders` | WorkOrderNumber | `$.WorkOrderNumbers` array |
|
||||
| `fn_GetSearchItemNumbers` | ItemNumber | `$.ItemNumbers` array |
|
||||
| `fn_GetSearchProfitCenters` | Code | `$.ProfitCenters` array |
|
||||
| `fn_GetSearchWorkCenters` | Code | `$.WorkCenters` array |
|
||||
| `fn_GetSearchOperatorIDs` | OperatorID | `$.OperatorIDs` array |
|
||||
| `fn_GetSearchComponentLots` | LotNumber, ItemNumber | `$.ComponentLotNumbers` array |
|
||||
| `fn_GetSearchPartOperations` | ItemNumber, OperationNumber, MisNumber, MisRevision | `$.PartOperations` array |
|
||||
|
||||
### Validation Procedure
|
||||
|
||||
| Procedure | Purpose |
|
||||
|-----------|---------|
|
||||
| `usp_ValidateSearchCriteria` | Validates search exists and has valid JSON criteria |
|
||||
|
||||
Error codes: 50001 (not found), 50002 (no criteria), 50003 (invalid JSON)
|
||||
|
||||
## Example Migration Scripts
|
||||
|
||||
### 001_CreateSearchTable.sql
|
||||
|
||||
Reference in New Issue
Block a user