-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.prisma
100 lines (89 loc) · 1.94 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
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
enum Gender {
FEMALE
MALE
}
enum Status {
DECEASED
DISCHARGED
HOSPITALISED
PENDING_ADMISSION
NO_ADMISSION
TO_BE_PROVIDED
}
enum Classification {
IMPORTED
LINKED_WITH_IMPORTED
LINKED_WITH_LOCAL
LINKED_WITH_POSSIBLY_LOCAL
LOCAL
POSSIBLY_LOCAL
}
enum District {
CENTRAL_AND_WESTERN
EASTERN
ISLANDS
KOWLOON_CITY
KWAI_TSING
KWUN_TONG
NORTH
SAI_KUNG
SHA_TIN
SHAM_SHUI_PO
SOUTHERN
TAI_PO
TSUEN_WAN
TUEN_MUN
WAN_CHAI
WONG_TAI_SIN
YAU_TSIM_MONG
YUEN_LONG
NA
}
model Case {
id Int @id /// Case Number
age Int
gender Gender
reportDate DateTime
onsetDate DateTime?
admissionDate DateTime?
dischargeDate DateTime?
deceaseDate DateTime?
confirmed Boolean
asymptomatic Boolean?
isHkResident Boolean?
status Status
classification Classification
buildings Building[] @relation(references: [id])
clusters Cluster[] @relation(references: [id])
}
model Cluster {
id Int @id @default(autoincrement())
name String @unique
cases Case[] @relation(references: [id])
}
model Building {
id Int @id @default(autoincrement())
name String
district District
lastDateOfResidenceOfCases DateTime?
isResidential Boolean
cases Case[] @relation(references: [id])
note String?
@@unique([name, district], name: "address")
}
// App state: singleton
model App {
id Int @id
lastHistoricalCasesVersion String?
lastHistoricalBuildingsVersion String?
lastHistoricalClustersVersion String?
}