Fix 001_init.js to follow proper migration pattern
Mirror to GitHub / mirror (push) Successful in 24s
Test and Lint / backend-test (push) Successful in 1m39s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m0s
Version and Release / version-bump (push) Successful in 33s
Version and Release / trigger-drone (push) Has been skipped

- Changed from standalone script to proper migration with exports.up/down
- Removed process.exit() calls that were terminating the migration runner
- Removed immediate execution of runMigrations()
- Now properly exports migration functions like other migrations

This was the root cause - 001_init.js was executing immediately when
required and calling process.exit(), preventing it from being run as
a migration and causing 029 to run first on an empty database.
This commit is contained in:
2025-07-25 13:00:03 +02:00
parent 4e052966d3
commit ccf59d1d4d
2 changed files with 10 additions and 7 deletions
@@ -141,6 +141,7 @@ async function runMigrations() {
const numB = parseInt(baseB.split('_')[0]);
return numA - numB;
});
console.log('Migration files in order:', migrationFiles.map(f => path.basename(f)));
} else {
// For existing deployments, run all migrations (legacy + core)
console.log('Existing deployment detected - checking all migrations');