workers/api/migrations/ has a collision at origin/main:
0092_ai_usage_payer.sql
0092_coder_repo_engine_copy.sql
Every other number in the directory is unique; these two are the only duplicate.
Why it is worth fixing even though it currently works
Wrangler applies migrations in filename order and records applied ones by name, so both files do run, and they happen to run in the order someone would want (ai_usage_payer sorts before coder_repo_engine_copy). Nothing is broken today.
But the ordering is now an accident of the words after the number rather than the number itself. Two consequences:
- The next collision may not be lucky. A
0092_a… added later would run before both, silently, with no warning — and migrations are the one thing in the system where order is the whole contract.
- It breaks the invariant a reader relies on. The number is how anyone reasons about "what ran before what"; two files claiming 0092 means the sequence can no longer be read off the names.
Fix
Renumber the later one to 0094_ (0093 is taken by 0093_notification_floor.sql) — only if it has not been applied to production yet. If it has, renaming is the wrong move: wrangler keys applied migrations by filename, so a rename re-runs it. In that case leave the files alone and add the guard below instead.
Either way, worth a cheap CI check: fail when two migration filenames share a numeric prefix. This is the same shape as the file-size ratchet and the test-isolation guard already in ci.yml — a class of mistake that is invisible in review and trivial to assert against.
Found while verifying #361's 0093_notification_floor.sql had landed.
workers/api/migrations/has a collision atorigin/main:Every other number in the directory is unique; these two are the only duplicate.
Why it is worth fixing even though it currently works
Wrangler applies migrations in filename order and records applied ones by name, so both files do run, and they happen to run in the order someone would want (
ai_usage_payersorts beforecoder_repo_engine_copy). Nothing is broken today.But the ordering is now an accident of the words after the number rather than the number itself. Two consequences:
0092_a…added later would run before both, silently, with no warning — and migrations are the one thing in the system where order is the whole contract.Fix
Renumber the later one to
0094_(0093 is taken by0093_notification_floor.sql) — only if it has not been applied to production yet. If it has, renaming is the wrong move: wrangler keys applied migrations by filename, so a rename re-runs it. In that case leave the files alone and add the guard below instead.Either way, worth a cheap CI check: fail when two migration filenames share a numeric prefix. This is the same shape as the file-size ratchet and the test-isolation guard already in
ci.yml— a class of mistake that is invisible in review and trivial to assert against.Found while verifying #361's
0093_notification_floor.sqlhad landed.