fix: wire runMigrations() into startup before initDatabase() #41
Reference in New Issue
Block a user
Delete Branch "fix/wire-migrations-to-startup"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
migrations.jsexisted but was never called fromserver/index.js. OnlyinitDatabase()was invoked on startup, meaning all migrations (001, 002, 003) were silently skipped on every container start — leaving any existingbreedr.dbwith its original schema intact.Fix
runMigrationsfrom./db/migrationsinserver/index.jsrunMigrations(DB_PATH)beforeinitDatabase()so schema is correct before any routes open connectionsprocess.exit(1)rather than silently running with a broken schemaAfter merging
Rebuild and restart the container. You should see Migration 003 output in the logs and
schema_versionwill be populated. Thehealth_recordsCHECK constraint will be removed automatically.