MCPcopy Create free account
hub / github.com/vercel/vercel / findUserSchema

Function findUserSchema

packages/python/src/quirks/prisma.ts:60–86  ·  view source on GitHub ↗

* Find the user's Prisma schema. * * Checks `PRISMA_SCHEMA_PATH` env var first, then falls back to common * locations: `schema.prisma` and `prisma/schema.prisma` in the project root.

(workPath: string)

Source from the content-addressed store, hash-verified

58 * locations: `schema.prisma` and `prisma/schema.prisma` in the project root.
59 */
60async function findUserSchema(workPath: string): Promise<string | null> {
61 const envPath = process.env.PRISMA_SCHEMA_PATH;
62 if (envPath) {
63 const resolved = isAbsolute(envPath) ? envPath : join(workPath, envPath);
64 try {
65 await fs.promises.access(resolved);
66 return resolved;
67 } catch {
68 debug(`PRISMA_SCHEMA_PATH=${envPath} not found at ${resolved}`);
69 return null;
70 }
71 }
72
73 const candidates = [
74 join(workPath, 'schema.prisma'),
75 join(workPath, 'prisma', 'schema.prisma'),
76 ];
77 for (const candidate of candidates) {
78 try {
79 await fs.promises.access(candidate);
80 return candidate;
81 } catch {
82 // try next
83 }
84 }
85 return null;
86}
87
88/** Recursively collect file paths under `dir`, relative to `base`. */
89async function collectFiles(dir: string, base: string): Promise<string[]> {

Callers 1

runFunction · 0.85

Calls 1

debugFunction · 0.90

Tested by

no test coverage detected