-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathseed.js
54 lines (51 loc) · 1.32 KB
/
seed.js
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
44
45
46
47
48
49
50
51
52
53
54
import { PrismaClient } from "@prisma/client";
import {
User,
Product,
Post,
FavoritePost,
PostComment,
ProductComment,
} from "./mock.js";
const prisma = new PrismaClient();
async function main() {
await prisma.user.deleteMany();
// await prisma.user.createMany({
// data: User,
// });
// await prisma.product.deleteMany();
// await prisma.product.createMany({
// data: Product,
// });
// await prisma.post.deleteMany();
// await prisma.post.createMany({
// data: Post,
// });
// await prisma.postfavoritepost.deleteMany();
// await prisma.postfavoritepost.createMany({
// data: FavoritePost,
// });
// await prisma.postComment.deleteMany();
// await prisma.postComment.createMany({
// data: PostComment,
// });
// await prisma.productComment.deleteMany();
// await prisma.productComment.createMany({
// data: ProductComment,
// });
// await prisma.user.deleteMany();
// await prisma.product.deleteMany();
// await prisma.article.deleteMany();
// await prisma.articleFavoriteUser.deleteMany();
// await prisma.articleComment.deleteMany();
// await prisma.productComment.deleteMany();
}
main()
.then(async () => {
await prisma.$disconnect();
})
.catch(async (err) => {
console.log(err.name);
await prisma.$disconnect();
process.exit(1);
});