Skip to content

Replay migrations skipped behind newer applied ledger rows - #1187

Open
sholub-dev wants to merge 1 commit into
get-bb:mainfrom
sholub-dev:fix-migrations-skipped-behind-newer-ledger-rows
Open

Replay migrations skipped behind newer applied ledger rows#1187
sholub-dev wants to merge 1 commit into
get-bb:mainfrom
sholub-dev:fix-migrations-skipped-behind-newer-ledger-rows

Conversation

@sholub-dev

@sholub-dev sholub-dev commented Aug 8, 2026

Copy link
Copy Markdown

Summary

Fixes #1186. Drizzle's sqlite migrator only applies journal entries whose timestamp is newer than the ledger's max created_at. A single branch-local migration row with a newer timestamp (e.g. from running a dev build) therefore makes it skip every later published migration, and validateAppliedMigrationHistory then fails startup with "Database migration history is incomplete after migration".

After the Drizzle pass, replay journal migrations that are missing from the ledger and newer than the newest applied journal entry. Gaps older than that are still reported by validation as before. This generalizes the existing one-off repairs for skipped migrations (e.g. the branch-local thread-tabs repair), whose timestamps can't be enumerated upstream.

Verified locally. Able to start the app after the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Could not start bb. bb-app exited before the server was ready with exit code 1. Version 0.36.0

1 participant