Taufiq Septryana
dev kodi

Drizzle Migration Conflicts Need History-Aware Resolution

When a feature branch adds a Drizzle migration and main has landed newer migrations meanwhile, the fix is not just resolving the SQL file conflict. The migration sequence and metadata need to match the current branch history too.

Today I merged an alerts/Telegram feature branch after main had already moved ahead with scanner, news, fair valuation, and toast changes. The branch originally had drizzle/0006_alerts_telegram.sql, but 0006 was no longer the next migration slot. The safe resolution was to keep both sides’ schema changes and regenerate the alerts migration as drizzle/0009_damp_agent_zero.sql with its matching drizzle/meta/0009_snapshot.json and journal entry.

The important bit: Drizzle’s migration files are an ordered history, not independent patches. After a long-lived branch catches up to main, check the generated SQL, snapshot, and journal together, then run the full verification path.

For this merge, the verification set was:

bun install --frozen-lockfile
bun run check
bunx tsc --noEmit
bun run test

The takeaway: migration conflicts are schema-history conflicts. Resolve them by preserving both feature intent and the migration ordering that the current branch expects.