-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathschema.zmodel
46 lines (40 loc) · 1 KB
/
schema.zmodel
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
datasource db {
provider = 'sqlite'
url = 'file:./dev.db'
}
plugin policy {
provider = '@core/policy'
}
enum Role {
ADMIN
USER
}
model User {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
email String @unique
name String?
postCount Int @computed
role Role @default(USER)
posts Post[]
profile Profile?
}
model Profile {
id String @id @default(cuid())
bio String?
age Int?
user User? @relation(fields: [userId], references: [id])
userId String? @unique
}
model Post {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String
content String
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id])
authorId String
}
mutation procedure signUp(email: String, name: String?): User