MCPcopy
hub / github.com/prisma/prisma / tearDownPostgres

Function tearDownPostgres

packages/client/src/utils/setupPostgres.ts:27–47  ·  view source on GitHub ↗
(connectionString: string)

Source from the content-addressed store, hash-verified

25}
26
27export async function tearDownPostgres(connectionString: string) {
28 const credentials = uriToCredentials(connectionString)
29 const credentialsClone = { ...credentials }
30 credentialsClone.database = 'postgres'
31 credentialsClone.schema = ''
32 const connectionStringCopy = credentialsToUri(credentialsClone)
33
34 const db = new Client({
35 connectionString: connectionStringCopy,
36 })
37
38 try {
39 await db.connect()
40 await db.query(`
41 DROP DATABASE IF EXISTS "${credentials.database}";
42 `)
43 } catch (e) {
44 console.error(e)
45 }
46 await db.end()
47}

Callers 11

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

Calls 6

uriToCredentialsFunction · 0.90
credentialsToUriFunction · 0.90
errorMethod · 0.80
endMethod · 0.80
connectMethod · 0.65
queryMethod · 0.45

Tested by

no test coverage detected