-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatamodel.prisma
More file actions
30 lines (28 loc) · 792 Bytes
/
datamodel.prisma
File metadata and controls
30 lines (28 loc) · 792 Bytes
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
type User {
id: ID! @unique
name: String!
email: String! @unique
password: String!
posts: [Post!]! @relation(name: "PostToUser", onDelete: CASCADE)
comments: [Comment!]! @relation(name: "CommentToUser", onDelete: CASCADE)
updatedAt: DateTime!
createdAt: DateTime!
}
type Post {
id: ID! @unique
title: String!
body: String!
published: Boolean!
author: User! @relation(name: "PostToUser", onDelete: SET_NULL)
comments: [Comment!]! @relation(name: "CommentToPost", onDelete: CASCADE)
updatedAt: DateTime!
createdAt: DateTime!
}
type Comment {
id: ID! @unique
text: String!
author: User! @relation(name: "CommentToUser", onDelete: SET_NULL)
post: Post! @relation(name: "CommentToPost", onDelete: SET_NULL)
updatedAt: DateTime!
createdAt: DateTime!
}