Commit e5a3764
fix(db): correct out-of-order when timestamp on migration 0012
Migration 0012_sync_job_signature was committed with
when = 1777600000000 (May 1 2026) — a hand-edited future timestamp,
later than the when values for 0013/0014/0015. drizzle's migrator
uses the journal's `when` as the row's created_at when inserting into
drizzle.__drizzle_migrations, then orders/compares by created_at to
decide what's pending. Once row 13 (= idx 12) lands with that future
timestamp, drizzle considers all subsequent migrations "older" and
silently skips them — exit 0, prints "[✓] migrations applied
successfully!", but rows aren't inserted and the schema stays behind.
Reproduced locally on a fresh DB at 13 rows with the buggy journal:
drizzle-kit migrate reports success but the schema lacks 0014/0015's
columns. Fixing only the journal's when value (with no other changes)
makes drizzle apply 0013/0014/0015 correctly to a 16-row tracking
table on the same fresh DB.
Sets when = 1776977000000 (sequential between 0011 at 1776976650701
and 0013 at 1777018090854).
Operators with existing prod whose row 13 was inserted at the buggy
timestamp must run, in addition to pulling this commit:
UPDATE drizzle.__drizzle_migrations
SET created_at = 1776977000000
WHERE created_at = 1777600000000;
Otherwise drizzle's "find pending" check will continue to skip future
migrations whose `when` < 1777600000000 (which is everything generated
before May 1 2026).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 11bc9b3 commit e5a3764
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
0 commit comments