MCPcopy
hub / github.com/prisma/prisma / main

Function main

sandbox/tracing/index.ts:19–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17})
18
19async function main() {
20 const prisma = new PrismaClient()
21
22 const email = Date.now() + '@gmail.com'
23
24 await prisma.user.create({
25 data: {
26 name: 'Alice',
27 email: email,
28 posts: {
29 create: { title: 'Hello World' },
30 },
31 profile: {
32 create: { bio: 'I like turtles' },
33 },
34 },
35 })
36
37 await prisma.user.findFirst()
38 await prisma.user.findMany()
39
40 await prisma.$transaction([
41 prisma.user.findUnique({
42 where: { email },
43 }),
44 prisma.user.findMany({}),
45 ])
46
47 await prisma.$transaction(async (tx) => {
48 await tx.user.findFirst()
49 await tx.user.findFirst()
50 })
51
52 await prisma.$disconnect()
53}

Callers 1

index.tsFile · 0.70

Calls 5

$transactionMethod · 0.95
$disconnectMethod · 0.95
findFirstMethod · 0.80
findManyMethod · 0.80
createMethod · 0.45

Tested by

no test coverage detected