From 3e65a89fe8d597af41935ef88fec1603fbabacf3 Mon Sep 17 00:00:00 2001 From: Robin Choice Date: Sun, 12 Apr 2026 20:22:17 +0200 Subject: [PATCH] Fix migration path resolution in Docker Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/api/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/api/src/index.ts b/apps/api/src/index.ts index d06a74a..04a87fb 100644 --- a/apps/api/src/index.ts +++ b/apps/api/src/index.ts @@ -20,7 +20,11 @@ const db = createDb(process.env.DATABASE_URL!); if (process.env.NODE_ENV === 'production') { console.log('[Boot] Running migrations...'); try { - await migrate(db, { migrationsFolder: './packages/db/src/migrations' }); + // Resolve relative to the working directory (which is /app in Docker) + const path = await import('path'); + const folder = path.resolve(process.cwd(), 'packages/db/src/migrations'); + console.log(`[Boot] Migrations folder: ${folder}`); + await migrate(db, { migrationsFolder: folder }); console.log('[Boot] Migrations applied.'); } catch (err) { console.error('[Boot] Migration failed:', err);