The open-source app everyone uses to manage agents at work
TypeScript acpxagent-orchestrationagent-skillsagentic-aiai-agentsai-engineeringai-governanceai-toolsautonomous-agentsclaudeclaude-codeclaude-skillscodexhermesllmmcpmulti-agentopenclawproject-managementworkflow-automation
fix(db): use fileURLToPath for Windows-safe migration paths
Matt Van Hornc59e059976c2
diff --git a/packages/db/src/client.ts b/packages/db/src/client.tsindex 93edb2a570..2571d8b8af 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<MigrationBoot}const db = drizzlePg(sql);- const migrationsFolder = new URL("./migrations", import.meta.url).pathname;+ const migrationsFolder = fileURLToPath(new URL("./migrations", import.meta.url));await migratePg(db, { migrationsFolder });return { migrated: true, reason: "migrated-empty-db", tableCount: 0 };