forked from redwoodjs/redwood
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.prisma
74 lines (65 loc) · 1.75 KB
/
schema.prisma
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
datasource db {
provider = "postgresql"
url = env("DB_HOST")
}
generator client {
provider = "prisma-client-js"
}
// Define your own models here and run yarn db:save to create
// migrations for them.
model Post {
id Int @id @default(autoincrement())
title String
slug String @unique
author String
body String
image String?
postedAt DateTime?
isPinned Boolean @default(false)
readTime Decimal @default(1.0)
rating Float?
upvotes Int @default(0)
metadata Json
hugeNumber BigInt @default(9007199254740992)
favorites Favorite[]
tag Tag[]
}
model User {
id Int @id @default(autoincrement())
name String?
email String @unique
isAdmin Boolean @default(false)
profiles UserProfile[]
}
model UserProfile {
id Int @id @default(autoincrement())
username String @unique
userId Int
user User @relation(fields: [userId], references: [id])
}
model NoEditableField {
id Int @id
}
model Favorite {
id Int @id @default(autoincrement())
postId Int
post Post @relation(fields: [postId], references: [id])
likes BigInt
}
model ExcludeDefault {
id Int @id @default(autoincrement())
auto Int @default(autoincrement())
number Int @default(99)
foobar String @default("foobar")
cuid String @default(cuid())
uuid String @default(uuid())
updatedTime DateTime @updatedAt
nowTime DateTime @default(now())
otherTime DateTime
}
model Tag {
id Int @id @default(autoincrement())
name String @unique
post Post? @relation(fields: [postId], references: [id])
postId Int?
}