-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.prisma
150 lines (131 loc) · 4.31 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
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = "postgresql://postgres:fighting@localhost:5432/performanceWattWise"
}
model User {
user_id Int @id @default(autoincrement())
username String
password String
email String
zipcode Int
counters Counter[]
}
model Counter {
counter_id Int @id @default(autoincrement())
user_id Int
type String
count Int
timestamp DateTime
daily_consumption DailyConsumption[]
weekly_consumption WeeklyConsumption[]
monthly_consumption MonthlyConsumption[]
yearly_consumption YearlyConsumption[]
user User @relation(fields: [user_id], references: [user_id])
@@unique([user_id, type])
}
model DailyConsumption {
consumption_id Int @id @default(autoincrement())
counter_id Int
consumption_date DateTime
consumption_counts Int[]
counter Counter @relation(fields: [counter_id], references: [counter_id])
@@unique([counter_id, consumption_date])
}
model WeeklyConsumption {
consumption_id Int @id @default(autoincrement())
counter_id Int
consumption_week_start DateTime
consumption_week_counts Int[]
counter Counter @relation(fields: [counter_id], references: [counter_id])
}
model MonthlyConsumption {
consumption_id Int @id @default(autoincrement())
counter_id Int
consumption_month DateTime
consumption_month_counts Int[]
counter Counter @relation(fields: [counter_id], references: [counter_id])
}
model YearlyConsumption {
consumption_id Int @id @default(autoincrement())
counter_id Int
consumption_year Int
consumption_year_counts Int[]
counter Counter @relation(fields: [counter_id], references: [counter_id])
}
// model User {
// User_ID Int @id @default(autoincrement())
// Surname String
// Firstname String
// Email String @unique
// Zipcode Int
// Password String
// Created_at DateTime
// Role String @default("user")
// bills Bill[]
// Consumption Consumption[]
// flatmates Flatmate[]
// payments Payment[]
// }
// model Consumption {
// User_ID Int
// Date DateTime @default(now())
// count Int
// counter_type String
// Day Int
// Month Int
// Year Int
// WeekOfYear Int
// ID Int @id @default(autoincrement())
// User User @relation(fields: [User_ID], references: [User_ID])
// }
// model Flatmate {
// Flatmate_ID Int @id @default(autoincrement())
// Name String
// Email String
// Created_at DateTime
// User_ID Int
// bills Bill_Flatmate[]
// user User @relation(fields: [User_ID], references: [User_ID])
// payments Payment[]
// }
// model Bill {
// Bill_ID Int @id @default(autoincrement())
// Total_amount Float
// Paid Boolean
// Created_at DateTime
// User_ID Int
// user User @relation(fields: [User_ID], references: [User_ID])
// flatmates Bill_Flatmate[]
// payments Payment_Bill[]
// }
// model Bill_Flatmate {
// Bill_ID Int
// Flatmate_ID Int
// bill Bill @relation(fields: [Bill_ID], references: [Bill_ID])
// flatmate Flatmate @relation(fields: [Flatmate_ID], references: [Flatmate_ID])
// @@id([Bill_ID, Flatmate_ID])
// }
// model Payment {
// Payment_ID Int @id @default(autoincrement())
// Amount Float
// Completed Boolean
// Created_at DateTime
// User_ID Int
// Flatmate_ID Int
// flatmate Flatmate @relation(fields: [Flatmate_ID], references: [Flatmate_ID])
// user User @relation(fields: [User_ID], references: [User_ID])
// bills Payment_Bill[]
// }
// model Payment_Bill {
// Payment_ID Int
// Bill_ID Int
// bill Bill @relation(fields: [Bill_ID], references: [Bill_ID])
// payment Payment @relation(fields: [Payment_ID], references: [Payment_ID])
// @@id([Payment_ID, Bill_ID])
// }
// model Topics {
// name String @unique
// }