Commit 4aa768b
committed
fix: parse SQLite DATE strings before forwarding to MariaDB mirror
The prior revision patched Sequelize's base DATE._stringify to force
a MariaDB-safe format, on the hypothesis that some steady-state write
paths bypassed the mysql.DATE subclass. Empirical tracing (all three
write paths - single INSERT, bulk INSERT, INSERT ... ON DUPLICATE KEY
UPDATE - instrumented against the query generator) shows that is NOT
the case: every MySQL write dispatches through mysql.DATE.stringify,
which already emits "YYYY-MM-DD HH:mm:ss".
The actual source of the residual "Incorrect datetime value" CI errors
was the reconnect-backfill path. `source.findAll({ raw: true })`
returns SQLite DATE columns as raw strings ("YYYY-MM-DD HH:mm:ss.SSS
+00:00") without running sqlite.DATE.parse. The strings were forwarded
verbatim into `mirror.bulkCreate`, which MariaDB strict mode rejected.
Fix: drop `raw: true` from backfill's findAll calls. Model instances
run sqlite.DATE.parse during construction, so DATE columns become Date
objects on dataValues; mysql.DATE then serialises them safely.
Use `.get({ plain: true, raw: true })` to extract the plain payload -
plain:true alone runs attribute-level `get()` accessors, which would
corrupt columns like ProjectV2.projectSector (stored as JSON, returned
as Array by the getter) when bulkCreate'd into the mirror's STRING/TEXT
column.
The sqlite PK-only orphan sweep keeps `raw: true` - its projection
excludes DATE and custom-getter columns, and a comment now documents
that invariant.
Revert the previous base-class `_stringify` monkey-patch and the
no-op `timezone: "+00:00"` constructor options (that value is already
Sequelize's default). Simplify the datetime regression test to pin
only the mysql subclass's output contract - the one Sequelize API we
actually depend on.1 parent 5d23732 commit 4aa768b
4 files changed
Lines changed: 76 additions & 103 deletions
File tree
- src
- config
- database
- v2
- tests/v2/integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | 1 | | |
4 | 2 | | |
5 | 3 | | |
6 | 4 | | |
7 | 5 | | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 6 | | |
54 | 7 | | |
55 | 8 | | |
| |||
108 | 61 | | |
109 | 62 | | |
110 | 63 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | 64 | | |
124 | 65 | | |
125 | 66 | | |
| |||
155 | 96 | | |
156 | 97 | | |
157 | 98 | | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | 99 | | |
162 | 100 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
335 | 340 | | |
336 | 341 | | |
337 | 342 | | |
| |||
475 | 480 | | |
476 | 481 | | |
477 | 482 | | |
478 | | - | |
479 | | - | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
480 | 498 | | |
481 | 499 | | |
482 | 500 | | |
483 | 501 | | |
484 | | - | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
485 | 506 | | |
486 | 507 | | |
487 | 508 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
500 | | - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
501 | 516 | | |
502 | 517 | | |
503 | 518 | | |
504 | 519 | | |
505 | | - | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
506 | 524 | | |
507 | 525 | | |
508 | 526 | | |
| |||
581 | 599 | | |
582 | 600 | | |
583 | 601 | | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
584 | 607 | | |
585 | 608 | | |
586 | 609 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | 4 | | |
10 | 5 | | |
11 | 6 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | | - | |
20 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | | - | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | | - | |
26 | | - | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 36 | | |
47 | 37 | | |
48 | | - | |
| 38 | + | |
| 39 | + | |
49 | 40 | | |
50 | | - | |
| 41 | + | |
51 | 42 | | |
52 | | - | |
| 43 | + | |
53 | 44 | | |
54 | 45 | | |
0 commit comments