-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
70 lines (55 loc) · 1.42 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
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
model Task {
id Int @id @default(autoincrement())
startTime DateTime @default(now())
description String
isComplete Boolean @default(false)
duration Int
userId String
habit Habit @relation(fields: [habitId], references: [id])
habitId Int
@@index(habitId)
}
model Habit {
id Int @id @default(autoincrement())
name String
// The end date of the habit
timeframe DateTime
userId String
constraints HabitConstraint[]
tasks Task[]
}
model HabitConstraint {
id Int @id @default(autoincrement())
prompt String
value String
userId String
habit Habit @relation(fields: [habitId], references: [id])
habitId Int
@@index(habitId)
}
model HabitCategory {
id Int @id @default(autoincrement())
name String @unique
tier Int
questions Question[]
}
model Question {
id Int @id @default(autoincrement())
prompt String
categoryId Int
category HabitCategory @relation(fields: [categoryId], references: [id])
// "input" | "multiple"
type String
followUpId Int? @unique
followUp Question? @relation("FollowUpQuestion", fields: [followUpId], references: [id])
options String[]
parent Question? @relation("FollowUpQuestion")
}