Overview
The backend contains two independent database migration mechanisms:
MigrationRunner + createPool driven by AUTO_RUN_MIGRATIONS (defaults to running, checks DATABASE_URL)
Migrator driven by AUTO_MIGRATE (runs only when set to 'true')
Both run at startup with different triggering semantics and different defaults, so which migrations actually run depends on which env vars happen to be set. This is a recipe for schema drift between environments.
Evidence
backend/src/index.ts — MigrationRunner/autoMigrate under AUTO_RUN_MIGRATIONS
backend/src/index.ts — Migrator/migrator.up() under AUTO_MIGRATE
Acceptance Criteria
Files to Modify
backend/src/index.ts
backend/src/utils/migrate.ts
.env.example
Priority: Medium
Overview
The backend contains two independent database migration mechanisms:
MigrationRunner+createPooldriven byAUTO_RUN_MIGRATIONS(defaults to running, checksDATABASE_URL)Migratordriven byAUTO_MIGRATE(runs only when set to'true')Both run at startup with different triggering semantics and different defaults, so which migrations actually run depends on which env vars happen to be set. This is a recipe for schema drift between environments.
Evidence
backend/src/index.ts—MigrationRunner/autoMigrateunderAUTO_RUN_MIGRATIONSbackend/src/index.ts—Migrator/migrator.up()underAUTO_MIGRATEAcceptance Criteria
.env.exampleFiles to Modify
backend/src/index.tsbackend/src/utils/migrate.ts.env.examplePriority: Medium