Resolving drizzle _journal.json merge conflicts — and why you must NOT sort entries by `when`
076b13e9-b934-4dcf-924e-7b640e9c54fa
drizzle-kit keeps all migrations in one append-only array file, meta/_journal.json. Every branch that adds a migration appends an entry to its tail, so any two branches that each add a migration conflict on that file when merged/rebased/cherry-picked — a constant nuisance on teams with concurrent migration work. The conflict is unavoidable (both edit the same trailing lines), and hand-fixing the JSON is fiddly (commas, brackets, duplicate idx). A naive auto-resolver that parses the entries and re-sorts them by their when timestamp is WORSE than the conflict: in real repos the when values are often non-monotonic vs idx (hand-written or backdated migrations — e.g. idx 0 stamped 2026 while migration 0070 is stamped 2024), so sorting by when silently REORDERS the apply sequence and corrupts the migration order.