-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
177 lines (162 loc) · 5.1 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
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
// previewFeatures = []
}
generator dbml {
provider = "prisma-dbml-generator"
}
model User {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
lastLogin DateTime?
username String @unique
email String @unique
password String
firstname String?
lastname String?
role Role @default(USER)
storyComment StoryComment[]
developerProjects ProjectDeveloper[]
tasks Task[]
timeLogs TimeLog[]
posts Post[]
projectOwnerProjects Project[] @relation("UserProjectOwner")
ScrumMasterProjects Project[] @relation("UserScrumMaster")
}
/// user type
enum Role {
ADMIN /// allowed to do everything
USER
}
model Sprint {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
start DateTime
end DateTime
velocity Float
Project Project? @relation(fields: [projectId], references: [id])
projectId Int?
UserStories UserStory[]
name String?
tasks Task[]
}
model StoryComment {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
userStoryId Int
message String
User User @relation(fields: [userId], references: [id])
userId Int
UserStory UserStory @relation(fields: [userStoryId], references: [id])
}
model Task {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
title String
description String
estimate Float
status TaskStatus @default(UNASSIGNED)
assignedTo User? @relation(fields: [userId], references: [id])
userId Int?
timeLogs TimeLog[]
UserStory UserStory? @relation(fields: [userStoryId], references: [id])
userStoryId Int?
Sprint Sprint? @relation(fields: [sprintId], references: [id])
sprintId Int?
}
enum TaskStatus {
UNASSIGNED
ASSIGNED
FINISHED
ACCEPTED
}
model UserStory {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
title String
description String
priority StoryPriority
points Float?
acceptanceTest Boolean @default(false)
projectId Int
project Project @relation(fields: [projectId], references: [id])
sprintId Int?
acceptanceCriteria String
comments StoryComment[]
Task Task[]
businessValue Int?
Sprint Sprint? @relation(fields: [sprintId], references: [id])
}
enum StoryPriority {
MUST_HAVE
COULD_HAVE
SHOULD_HAVE
WONT_HAVE
}
model TimeLog {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
day DateTime
hours Float
User User @relation(fields: [userId], references: [id])
userId Int
Task Task @relation(fields: [taskId], references: [id])
taskId Int
remainingHours Float
title String
}
model Post {
id Int @id @default(autoincrement())
message String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
user User? @relation(fields: [userId], references: [id])
userId Int?
Project Project? @relation(fields: [projectId], references: [id])
projectId Int?
}
model ProjectDeveloper {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
user User @relation(fields: [userId], references: [id])
userId Int
project Project @relation(fields: [projectId], references: [id])
projectId Int
@@unique([userId, projectId])
}
model Project {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
title String
documentation String?
description String
projectOwner User @relation(fields: [projectOwnerId], references: [id], name: "UserProjectOwner")
scrumMaster User @relation(fields: [scrumMasterId], references: [id], name: "UserScrumMaster")
developers ProjectDeveloper[]
sprints Sprint[]
posts Post[]
UserStory UserStory[]
projectOwnerId Int
scrumMasterId Int
}