fix: genesis migration to unblock migration chain on empty DB#756
Merged
Conversation
The 73-migration chain was written against a pre-existing schema and cannot replay from scratch — migration #2 fails with 'relation language does not exist'. This genesis migration (timestamp 1763036250000) runs first on any DB and: - Creates all enums, sequences, tables and constraints in their current final form using IF NOT EXISTS / DO EXCEPTION blocks (idempotent) - Marks all 73 existing migrations as already-run in be_migrations so TypeORM skips them on both fresh and existing DBs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
need4deed
approved these changes
Jul 13, 2026
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AddEventEntity) tries to add a FK to thelanguagetable which doesn't exist, causingrelation "language" does not exist1763036250000(runs first) that creates the full schema in idempotent form and marks all 73 prior migrations as already-run inbe_migrationsIF NOT EXISTS/DO EXCEPTION/WHERE NOT EXISTSguards make every statement a no-op — zero schema driftTest plan
docker compose down -v && RUN_MIGRATIONS=1 docker compose up—belogs must reachMigrations completedwith no errorsyarn migration:runon a populated local DB — genesis runs, all statements no-op, no errors🤖 Generated with Claude Code