MCPcopy
hub / github.com/prisma/prisma / processSchemaResult

Function processSchemaResult

packages/internals/src/cli/schemaContext.ts:78–108  ·  view source on GitHub ↗
({
  schemaResult,
  printLoadMessage = true,
  cwd = process.cwd(),
}: {
  schemaResult: GetSchemaResult
  printLoadMessage?: boolean
  cwd?: string
})

Source from the content-addressed store, hash-verified

76}
77
78export async function processSchemaResult({
79 schemaResult,
80 printLoadMessage = true,
81 cwd = process.cwd(),
82}: {
83 schemaResult: GetSchemaResult
84 printLoadMessage?: boolean
85 cwd?: string
86}): Promise<SchemaContext> {
87 const loadedFromPathForLogMessages = path.relative(cwd, schemaResult.schemaPath)
88 const schemaRootDir = schemaResult.schemaRootDir || cwd
89
90 if (printLoadMessage) {
91 printSchemaLoadedMessage(loadedFromPathForLogMessages)
92 }
93
94 const configFromPsl = await getConfig({ datamodel: schemaResult.schemas })
95
96 const primaryDatasource = configFromPsl.datasources.at(0)
97
98 return {
99 schemaFiles: schemaResult.schemas,
100 schemaPath: schemaResult.schemaPath,
101 schemaRootDir,
102 datasources: configFromPsl.datasources,
103 generators: configFromPsl.generators,
104 primaryDatasource,
105 warnings: configFromPsl.warnings,
106 loadedFromPathForLogMessages,
107 }
108}
109
110export function getSchemaDatasourceProvider(schemaContext: SchemaContext): ActiveConnectorType {
111 if (schemaContext.primaryDatasource === undefined) {

Callers 3

setupTestSuiteClientFunction · 0.90
parseMethod · 0.90
loadSchemaContextFunction · 0.85

Calls 2

printSchemaLoadedMessageFunction · 0.90
getConfigFunction · 0.90

Tested by

no test coverage detected