MCPcopy
hub / github.com/prisma/prisma / readSchemaFromSingleFile

Function readSchemaFromSingleFile

packages/internals/src/cli/getSchema.ts:114–127  ·  view source on GitHub ↗
(schemaPath: string)

Source from the content-addressed store, hash-verified

112}
113
114async function readSchemaFromSingleFile(schemaPath: string): Promise<LookupResult> {
115 debug('Reading schema from single file', schemaPath)
116
117 const typeError = await ensureType(schemaPath, 'file')
118 if (typeError) {
119 return { ok: false, error: typeError }
120 }
121 const file = await readFile(schemaPath, { encoding: 'utf-8' })
122 const schemaTuple: MultipleSchemaTuple = [schemaPath, file]
123 return {
124 ok: true,
125 schema: { schemaPath, schemaRootDir: path.dirname(schemaPath), schemas: [schemaTuple] },
126 } as const
127}
128
129async function readSchemaFromDirectory(schemaPath: string): Promise<LookupResult> {
130 debug('Reading schema from multiple files', schemaPath)

Callers 2

getDefaultSchemaFunction · 0.85

Calls 2

ensureTypeFunction · 0.90
debugFunction · 0.85

Tested by

no test coverage detected