MCPcopy
hub / github.com/prisma/prisma / getDbLocation

Function getDbLocation

packages/migrate/src/utils/ensureDatabaseExists.ts:172–188  ·  view source on GitHub ↗
(credentials: DatabaseCredentials)

Source from the content-addressed store, hash-verified

170
171// returns the "host" like localhost / 127.0.0.1 + default port
172export function getDbLocation(credentials: DatabaseCredentials): string | undefined {
173 if (credentials.type === 'sqlite') {
174 return credentials.uri!
175 }
176
177 const socket = getSocketFromDatabaseCredentials(credentials)
178
179 if (socket) {
180 return `unix:${socket}`
181 } else if (credentials.host && credentials.port) {
182 return `${credentials.host}:${credentials.port}`
183 } else if (credentials.host) {
184 return `${credentials.host}`
185 }
186
187 return undefined
188}
189
190/**
191 * Return a pretty version of a "provider" (with uppercase characters)

Callers 2

parseDatasourceInfoFunction · 0.85
ensureDatabaseExistsFunction · 0.85

Calls 1

Tested by

no test coverage detected