import path from "node:path"; import { getDrizzlePkgRoot } from "./paths"; /** 将 `file:` 相对路径解析为绝对路径(相对 drizzle-pkg 根目录) */ export function resolveSqliteDatabaseUrl(url: string): string { if (!url.startsWith("file:")) { return url; } let filePath = url.slice("file:".length); if (path.isAbsolute(filePath)) { return `file:${filePath}`; } const root = getDrizzlePkgRoot(); return `file:${path.resolve(root, filePath)}`; }