MCPcopy
hub / github.com/prisma/prisma / printDatasource

Function printDatasource

packages/migrate/src/utils/printDatasource.ts:10–32  ·  view source on GitHub ↗
({ datasourceInfo }: { datasourceInfo: DatasourceInfo })

Source from the content-addressed store, hash-verified

8// Datasource "my_db": MongoDB database "tests-migrate" at "localhost:27017"
9// Datasource "my_db": SQL Server database
10export function printDatasource({ datasourceInfo }: { datasourceInfo: DatasourceInfo }): void {
11 if (!datasourceInfo.name || !datasourceInfo.prettyProvider) return
12
13 let message = `Datasource "${datasourceInfo.name}": ${datasourceInfo.prettyProvider} database`
14 if (datasourceInfo.dbName) {
15 message += ` "${datasourceInfo.dbName}"`
16 }
17
18 // If schemas are defined in the datasource block, print them
19 if (datasourceInfo.schemas?.length) {
20 message += `, schemas "${datasourceInfo.schemas.join(', ')}"`
21 }
22 // Otherwise, print the schema if it's defined in the connection string
23 else if (datasourceInfo.schema) {
24 message += `, schema "${datasourceInfo.schema}"`
25 }
26
27 if (datasourceInfo.dbLocation) {
28 message += ` at "${datasourceInfo.dbLocation}"`
29 }
30
31 process.stdout.write(dim(message) + '\n')
32}

Callers 8

parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90
parseMethod · 0.90

Calls 1

writeMethod · 0.65

Tested by

no test coverage detected