Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

fix(db): resolve the migration directory as a filesystem path (#364)

Ahmad Othman Ammar Adi0eb77d110499
diff --git a/packages/db/src/migrate.ts b/packages/db/src/migrate.ts
index 0d93aa16..0e65110e 100644
--- a/packages/db/src/migrate.ts
+++ b/packages/db/src/migrate.ts
@@ -1,6 +1,7 @@
// Programmatic migration runner — used on api container startup
// (drizzle-kit is not needed in production, only the generated SQL in ./drizzle).
import { readFileSync } from 'node:fs';
+import { fileURLToPath } from 'node:url';
import { drizzle } from 'drizzle-orm/postgres-js';
import { migrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';
@@ -20,7 +21,7 @@ if (!connectionString) {
const migrationClient = postgres(connectionString, { max: 1 });
const db = drizzle(migrationClient);
-const migrationsFolder = new URL('../drizzle', import.meta.url).pathname;
+const migrationsFolder = fileURLToPath(new URL('../drizzle', import.meta.url));
// Compose orders the api behind a healthy postgres, but a platform without that
// guarantee (Railway, plain `docker run`) starts both at once and the first