From c59e059976c2556927eb10bf93487105e2489e79 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Sat, 7 Mar 2026 16:17:45 -0800 Subject: [PATCH 1/2] fix(db): use fileURLToPath for Windows-safe migration paths URL.pathname returns /C:/... on Windows, causing doubled drive letters when Node prepends the current drive. fileURLToPath handles this correctly across platforms. Fixes #132 Co-Authored-By: Claude Opus 4.6 --- packages/db/src/client.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/db/src/client.ts b/packages/db/src/client.ts index 93edb2a5..2571d8b8 100644 --- a/packages/db/src/client.ts +++ b/packages/db/src/client.ts @@ -2,12 +2,13 @@ import { createHash } from "node:crypto"; import { drizzle as drizzlePg } from "drizzle-orm/postgres-js"; import { migrate as migratePg } from "drizzle-orm/postgres-js/migrator"; import { readFile, readdir } from "node:fs/promises"; +import { fileURLToPath } from "node:url"; import postgres from "postgres"; import * as schema from "./schema/index.js"; -const MIGRATIONS_FOLDER = new URL("./migrations", import.meta.url).pathname; +const MIGRATIONS_FOLDER = fileURLToPath(new URL("./migrations", import.meta.url)); const DRIZZLE_MIGRATIONS_TABLE = "__drizzle_migrations"; -const MIGRATIONS_JOURNAL_JSON = new URL("./migrations/meta/_journal.json", import.meta.url).pathname; +const MIGRATIONS_JOURNAL_JSON = fileURLToPath(new URL("./migrations/meta/_journal.json", import.meta.url)); function isSafeIdentifier(value: string): boolean { return /^[A-Za-z_][A-Za-z0-9_]*$/.test(value); @@ -702,7 +703,7 @@ export async function migratePostgresIfEmpty(url: string): Promise Date: Sat, 7 Mar 2026 17:01:36 -0800 Subject: [PATCH 2/2] fix(db): reuse MIGRATIONS_FOLDER constant instead of recomputing The local migrationsFolder variable in migratePostgresIfEmpty duplicated the module-level MIGRATIONS_FOLDER constant. Reuse the constant to keep a single source of truth for the migration path. Co-Authored-By: Claude Opus 4.6 --- packages/db/src/client.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/db/src/client.ts b/packages/db/src/client.ts index 2571d8b8..8fa979d2 100644 --- a/packages/db/src/client.ts +++ b/packages/db/src/client.ts @@ -703,8 +703,7 @@ export async function migratePostgresIfEmpty(url: string): Promise