Commit bb1bb84
committed
BACPAC loader —
**`EmitTableType`** (`SqlServerSimulator/Storage/Bacpac/ModelXmlReader.cs`, phase 1 alongside schemas / UDDTs / sequences / roles). Translates `<Element Type="SqlTableType" Name="[schema].[name]">` → `CREATE TYPE [schema].[name] AS TABLE (col_list [, PRIMARY KEY (cols)])`. Column children are `SqlTableTypeSimpleColumn` entries with the same `TypeSpecifier` + `IsNullable` / `IsIdentity` shape as regular `SqlSimpleColumn`, so `TranslateSimpleColumn` reuses cleanly. The optional `SqlTableTypePrimaryKeyConstraint` translates to a table-level anonymous `PRIMARY KEY (col1, col2, …)` clause; per [`docs/claude/table-valued-parameters.md`](docs/claude/table-valued-parameters.md), named constraints + UNIQUE/CHECK/FK are grammar-rejected inside table types, so the loader sticks to the anonymous PK form. The `IsClustered` annotation is dropped because table-variable storage is linear-scan regardless of the property. The dispatcher + `IsHandledByAnotherPhase` both gain `SqlTableType`.
**Cascade unblock**: dispatching table types in phase 1 (before procedures in phase 7) lets `CREATE PROCEDURE … @param TVPType READONLY` parse — the TVP parameter type resolution requires the table type to already exist in the schema's `TableTypes` dict at procedure-creation time. 3 of WWI's previously-failing procedures (`Website.SearchForCustomers`, `Website.SearchForStockItems`, `Website.SearchForPeople` — the ones taking `@OrderList` / `@StockItemList` / etc.) now parse cleanly, dropping `SqlProcedure` failures from 6 → 3. The remaining 3 are unrelated parse failures around `sp_addrolemember` modeling and similar.
**Test updates**:
- New `Load_WWI_Table_Types_Land_In_sys_table_types` — verifies the 4 WWI table types (Website.OrderIDList / OrderLineList / OrderList / SensorDataList) appear in `sys.table_types` after load.
- `Load_WWI_Known_Gaps_Recorded_In_Skipped` — `SqlTableType` removed from the expected-grouped list (now asserted *absent* via `IsFalse(grouped.ContainsKey("SqlTableType"))`); `SqlProcedure` expected count drops 6 → 3; the "extended properties on computed columns / table types" comment trims to just "computed columns" since the table-type ones now actually land.
**Doc updates**: `CLAUDE.md`'s BACPAC pointer adds "table types" to the phase-1 dispatch list and refreshes the WWI gap census. `docs/claude/bacpac-prerequisites.md` step 3 (the bundle history entry) gains the `EmitTableType` detail + cascade-unblock note; step 6's gap inventory drops `SqlTableType` and adjusts `SqlProcedure` (6 → 3), and the Status section's WWI summary picks up the 4/4 table-types count.
WWI now loads 48/48 tables + 26/26 sequences + 9/9 roles + **4/4 table types** + 4.7M rows. AW2025 unaffected (still 100% row coverage, every existing assertion green).SqlTableType dispatcher entry (+ cascade unblock of 3 procedures). WideWorldImporters now lands all 4 table types in sys.table_types and the previously-failing procedures that took TVP parameters of those types parse cleanly.1 parent 1df5862 commit bb1bb84
4 files changed
Lines changed: 104 additions & 10 deletions
File tree
- SqlServerSimulator.Tests.Internal/Storage
- SqlServerSimulator/Storage/Bacpac
- docs/claude
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
601 | | - | |
| 601 | + | |
| 602 | + | |
602 | 603 | | |
603 | | - | |
604 | | - | |
| 604 | + | |
605 | 605 | | |
606 | 606 | | |
607 | 607 | | |
| |||
611 | 611 | | |
612 | 612 | | |
613 | 613 | | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
614 | 635 | | |
615 | 636 | | |
616 | 637 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
147 | | - | |
| 148 | + | |
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
| |||
340 | 341 | | |
341 | 342 | | |
342 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
343 | 417 | | |
344 | 418 | | |
345 | 419 | | |
| |||
0 commit comments