You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 lines
482 B

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)}`;
}