Commit 1027349
committed
fix(tables): stop defaultMetadata overwriting caller-supplied column metadata
The previous commit's fix was defeated by its own last line. `defaultMetadata`
is spread AFTER the caller's metadata, and it was handed a bare
`{ name, type }` — so it re-answered from nothing and overwrote the values it
was meant to fall back to. An imported date column's `includeTime: true` became
`false`: the rows were coerced WITH their times while the column was saved
claiming to be date-only.
It now sees what the caller supplied, so `column.includeTime ?? false` falls
back only when the key is genuinely absent — the same shape `addTableColumn`
already had.
The builder is extracted as `buildAddedColumn` and exported, for the reason
this slipped through: the earlier test asserted what INFERENCE returns, not
what gets persisted, and the overwrite happens between the two. Testing the
persisted shape needed a transaction otherwise. Mirrors `buildConvertedColumn`.1 parent 99a0132 commit 1027349
2 files changed
Lines changed: 62 additions & 16 deletions
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
604 | 605 | | |
605 | 606 | | |
606 | 607 | | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
607 | 627 | | |
608 | 628 | | |
609 | 629 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
472 | 513 | | |
473 | 514 | | |
474 | 515 | | |
| |||
514 | 555 | | |
515 | 556 | | |
516 | 557 | | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
| 558 | + | |
533 | 559 | | |
534 | 560 | | |
535 | 561 | | |
| |||
0 commit comments