-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.ts
43 lines (38 loc) · 885 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const PrismaClient = require("@prisma/client").PrismaClient;
// import { PrismaClient } from "@prisma/client";
const prisma = new PrismaClient();
async function main() {
await prisma.user.create({
data: {
name: "Alice",
email: "[email protected]",
posts: {
create: { title: "Hello World" },
},
profile: {
create: { bio: "I like turtles" },
},
},
});
const allUsers = await prisma.user.findMany({
include: {
posts: true,
profile: true,
},
});
// const post = await prisma.post.update({
// where: { id: 1 },
// data: { published: true },
// });
// console.log(post);
console.dir(allUsers, { depth: null });
}
main()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (e) => {
console.error(e);
await prisma.$disconnect();
process.exit(1);
});