-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.prisma
79 lines (70 loc) · 2.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
75
76
77
78
79
datasource postgresql {
url = env("DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
output = "node_modules/.prisma/client"
}
model Action {
id Int @id @default(autoincrement())
title String?
datePublished DateTime?
image Json?
content Json?
relatedSdgs Sdg[] @relation("Action_relatedSdgs_Sdg_actions", references: [id])
categories Category[] @relation("Action_categories_Category_actions", references: [id])
from_Completion_action Completion[] @relation("Completionaction")
}
model Category {
id Int @id @default(autoincrement())
title String?
actions Action[] @relation("Action_categories_Category_actions", references: [id])
}
model Completion {
id Int @id @default(autoincrement())
completionDate DateTime?
action Action? @relation("Completionaction", fields: [actionId], references: [id])
actionId Int? @map("action")
user User? @relation("Completionuser", fields: [userId], references: [id])
userId Int? @map("user")
kudos User[] @relation("Completion_kudos_many", references: [id])
@@index([actionId])
@@index([userId])
}
model Idea {
id Int @id @default(autoincrement())
title String?
body String?
dateSubmitted DateTime?
user User? @relation("Ideauser", fields: [userId], references: [id])
userId Int? @map("user")
@@index([userId])
}
model Sdg {
id Int @id @default(autoincrement())
sdgNo Int?
title String?
description String?
content Json?
actions Action[] @relation("Action_relatedSdgs_Sdg_actions", references: [id])
from_User_favouriteSdgs User[] @relation("User_favouriteSdgs_many", references: [id])
}
model User {
id Int @id @default(autoincrement())
name String?
email String? @unique
password String?
profilePicture Json?
biography String?
areasOfInterest String?
funFacts String?
isAdmin Boolean?
passwordResetToken String?
passwordResetIssuedAt DateTime?
passwordResetRedeemedAt DateTime?
favouriteSdgs Sdg[] @relation("User_favouriteSdgs_many", references: [id])
completions Completion[] @relation("Completionuser")
from_Completion_kudos Completion[] @relation("Completion_kudos_many", references: [id])
from_Idea_user Idea[] @relation("Ideauser")
}