Run migrations on server startup

This commit is contained in:
unknown
2026-07-14 16:19:36 +09:00
parent e02afcda7d
commit 0ae4b73592
3 changed files with 38 additions and 6 deletions

View File

@@ -67,3 +67,9 @@ Node 서버에 Auth API를 추가했다.
2026-07-14 Auth API 커밋 배포 후 `POST /api/auth/login` 응답이 404에서 500으로 변경되었다.
판단: 라우터는 배포에 반영되었고, 남은 문제는 운영 DB의 사용자 seed 또는 로그인 처리 중 DB 상태 문제로 좁혀졌다. 다음 배포부터 테스트 계정이 자동 보장되도록 `migrations/005_seed_test_users.sql`을 추가한다.
2026-07-14 after Coolify redeploy, `/api/health` returned `build: auth-seed-20260714`.
However, `/api/auth/diagnostics` reported no `users` or `user_roles` table, and login still returned 500.
Conclusion: runtime migration is not guaranteed when Coolify overrides Dockerfile CMD. Added startup migration in `server/index.ts` so `runMigrations()` executes before the Express server starts.