-
-
Notifications
You must be signed in to change notification settings - Fork 143
Expand file tree
/
Copy pathschema.zmodel
More file actions
28 lines (25 loc) · 712 Bytes
/
schema.zmodel
File metadata and controls
28 lines (25 loc) · 712 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
datasource db {
provider = 'sqlite'
url = 'file:./dev.db'
}
/// User model
model User {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
email String @unique
name String?
posts Post[]
}
/// Post model
model Post {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String
published Boolean @default(false)
author User @relation(fields: [authorId], references: [id], onUpdate: Cascade, onDelete: Cascade)
authorId String
}
mutation procedure signUp(email: String): User
procedure listPublicPosts(): Post[]