Skip to content

Commit 19e8c09

Browse files
authored
Added prisma schema according to the chart (#6)
* Added prisma schema according to the chart * Added created_at and updated_at fields, changed id type to String and default it to uuid()
1 parent 8cc5bdd commit 19e8c09

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

prisma/schema.prisma

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,52 @@ datasource db {
99
provider = "postgresql"
1010
url = env("DATABASE_URL")
1111
}
12+
13+
model User {
14+
id String @id @default(uuid())
15+
email String @unique
16+
name String
17+
created_at DateTime @default(now())
18+
updated_at DateTime @updatedAt
19+
20+
work_requests WorkRequest[]
21+
}
22+
23+
model Work {
24+
id String @id @default(uuid())
25+
description String
26+
start_date DateTime
27+
approval_date DateTime
28+
completion_date DateTime
29+
work_type Int
30+
31+
work_request WorkRequest?
32+
//? If work should have more than one request, use:
33+
// work_requests WorkRequest[]
34+
}
35+
36+
model Authority {
37+
id String @id @default(uuid())
38+
name String
39+
email String @unique
40+
work_type Int
41+
42+
work_requests WorkRequest[]
43+
}
44+
45+
model WorkRequest {
46+
rating Float
47+
created_at DateTime @default(now())
48+
updated_at DateTime @updatedAt
49+
50+
work_id String @unique //? remove @unique if work can have more than one request
51+
work Work @relation(fields: [work_id], references: [id])
52+
53+
user_id String
54+
user User @relation(fields: [user_id], references: [id])
55+
56+
approving_authority_id String
57+
approving_authority Authority @relation(fields: [approving_authority_id], references: [id])
58+
59+
@@id([work_id, user_id])
60+
}

0 commit comments

Comments
 (0)