MCPcopy
hub / github.com/prisma/prisma / setupPostgres

Function setupPostgres

packages/client/src/utils/setupPostgres.ts:11–25  ·  view source on GitHub ↗
(options: SetupParams)

Source from the content-addressed store, hash-verified

9}
10
11export async function setupPostgres(options: SetupParams): Promise<void> {
12 const { connectionString } = options
13 const { dirname } = options
14 const schema = fs.readFileSync(path.join(dirname, 'setup.sql'), 'utf-8')
15
16 await createDatabase(connectionString).catch((e) => console.error(e))
17
18 const db = new Client({
19 connectionString: connectionString,
20 })
21
22 await db.connect()
23 await db.query(schema)
24 await db.end()
25}
26
27export async function tearDownPostgres(connectionString: string) {
28 const credentials = uriToCredentials(connectionString)

Callers 3

test.tsFile · 0.90
test.tsFile · 0.90
test.tsFile · 0.90

Calls 6

createDatabaseFunction · 0.90
catchMethod · 0.80
errorMethod · 0.80
endMethod · 0.80
connectMethod · 0.65
queryMethod · 0.45

Tested by

no test coverage detected