-
Notifications
You must be signed in to change notification settings - Fork 10
/
schema.prisma
232 lines (205 loc) · 7.23 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextSearch"]
}
datasource db {
provider = "postgresql"
url = env("POSTGRES_PRISMA_URL") // uses connection pooling
directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection
}
model Adventure {
id String @id @default(uuid())
creatorId String
createdBy String
createdAt DateTime @default(now())
deletedAt DateTime?
name String @default("Untitled Adventure")
description String @default("No description provivded.")
agentVersion String @default("ai-adventure")
shortDescription String @default("An exciting adventure driven by AI")
image String? @default("")
agentConfig Json?
agentDevConfig Json?
devAgentId Int? @unique
devAgent Agents? @relation("devAgentRelation", fields: [devAgentId], references: [id])
// Used for generating a full adventure - the state will be `generating` and the `stateTaskId` will be the
// ID of the task that represents the completion of the generation process.
state String?
stateTaskId String?
stateUpdatedAt DateTime?
// Whether to feature
featured Boolean @default(false)
// Whether it's visible by others
public Boolean @default(false)
publicRequested Boolean @default(false)
tags String[] @default([])
Agents Agents[] @relation("agents")
CharacterTemplate CharacterTemplate[]
updatedAt DateTime @default(now()) @updatedAt
Reactions Reactions[]
Comment Comment[]
AvailableAgents AvailableAgents[] @relation("availableAgents")
version Int @default(0)
NarrativeSnippet NarrativeSnippet[]
}
model Comment {
id Int @id @default(autoincrement())
adventureId String
userId String
comment String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Adventure Adventure @relation(fields: [adventureId], references: [id])
}
model CharacterTemplate {
id Int @id @default(autoincrement())
name String
description String
image String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Adventure Adventure? @relation(fields: [adventureId], references: [id])
adventureId String?
}
model Agents {
id Int @id @default(autoincrement())
ownerId String
agentUrl String
handle String @default("agent")
agentVersion String? @default("")
createdAt DateTime @default(now())
Adventure Adventure? @relation("agents", fields: [adventureId], references: [id])
adventureId String?
isDevelopment Boolean? @default(false)
DevAdventure Adventure? @relation("devAgentRelation")
workspaceId String?
workspaceHandle String?
completeOnboardingCalled Boolean?
adventureVersion Int @default(0)
}
// These agents are pre-created and available for use.
// They are not owned by any user -- instead they are taken over from a user and turned into an Agent row.
// These agents may only be taken over if they are in the `ready` state.
model AvailableAgents {
id Int @id @default(autoincrement())
agentUrl String?
handle String? @default("agent")
agentVersion String? @default("")
createdAt DateTime @default(now())
Adventure Adventure? @relation("availableAgents", fields: [adventureId], references: [id])
adventureId String?
gameState String?
isDevelopment Boolean? @default(false)
state String? @default("waiting") // waiting | creating | ready | claimed
workspaceId String?
workspaceHandle String?
completeOnboardingCalled Boolean?
adventureVersion Int @default(0)
}
model UserInfo {
userId String @id
firstName String?
lastName String?
email String?
username String? @unique
emailVerified Boolean?
profileImageUrl String?
privateMetadata Json?
publicMetadata Json?
unsafeMetadata Json?
isInternal Boolean? @default(false)
isAdmin Boolean? @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
avatarImage String? @default("")
}
model UserExperience {
id Int @id @default(autoincrement())
userId String
type String
expId String
experience Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([userId, type, expId])
}
model UserEnergy {
id Int @id @default(autoincrement())
userId String @unique
energy Int @default(100)
energyMax Int @default(100)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model UserApprovals {
id Int @id @default(autoincrement())
userId String @unique
isApproved Boolean @default(false)
}
model Subscriptions {
id Int @id @default(autoincrement())
ownerId String @unique
stripeId String
priceId String
subscriptionId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model TopUps {
id Int @id @default(autoincrement())
ownerId String
amountPaidCents Int // Amount paid
creditIncrease Int // Energy Added
reference String // Stripe reference
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model DrawDowns {
id Int @id @default(autoincrement())
ownerId String
creditDecrease Int // Energy Removed
reference String // Stripe reference
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Emojis {
id Int @id @default(autoincrement())
emoji String @unique
description String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Reactions Reactions[]
}
model Tags {
name String @id
count Int @default(0)
}
model Reactions {
id Int @id @default(autoincrement())
emojiId Int
userId String
adventureId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Emojis Emojis @relation(fields: [emojiId], references: [id])
Adventure Adventure @relation(fields: [adventureId], references: [id])
@@unique([userId, emojiId, adventureId])
}
model Feedback {
id String @id @default(cuid())
userId String
isPositive Boolean
feedback String? @default("")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
url String? @default("")
}
model NarrativeSnippet {
id Int @id @default(autoincrement())
userId String
text String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
adventureId String
Adventure Adventure @relation(fields: [adventureId], references: [id])
}