Skip to content

Commit 96feaf3

Browse files
docs: update public schemas
1 parent d08cfee commit 96feaf3

File tree

1 file changed

+94
-6
lines changed

1 file changed

+94
-6
lines changed

DatabaseSchema.md

Lines changed: 94 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,17 @@
1313
- [archivedSponsorTimes](#archivedsponsortimes)
1414
- [ratings](#ratings)
1515
- [userFeatures](#userFeatures)
16+
- [shadowBannedIPs](#shadowBannedIPs)
1617
- [titles](#titles)
1718
- [titleVotes](#titleVotes)
1819
- [thumbnails](#thumbnails)
20+
- [thumbnailTimestamps](#thumbnailTimestamps)
1921
- [thumbnailVotes](#thumbnailVotes)
2022

2123
### vipUsers
2224
| Name | Type | |
2325
| -- | :--: | -- |
24-
| userID | TEXT | not null |
26+
| userID | TEXT | not null, primary key |
2527

2628
| index | field |
2729
| -- | :--: |
@@ -37,7 +39,7 @@
3739
| votes | INTEGER | not null |
3840
| locked | INTEGER | not null, default '0' |
3941
| incorrectVotes | INTEGER | not null, default 1 |
40-
| UUID | TEXT | not null, unique |
42+
| UUID | TEXT | not null, unique, primary key |
4143
| userID | TEXT | not null |
4244
| timeSubmitted | INTEGER | not null |
4345
| views | INTEGER | not null |
@@ -66,7 +68,7 @@
6668

6769
| Name | Type | |
6870
| -- | :--: | -- |
69-
| userID | TEXT | not null |
71+
| userID | TEXT | not null, primary key |
7072
| userName | TEXT | not null |
7173
| locked | INTEGER | not nul, default '0' |
7274

@@ -81,6 +83,7 @@
8183
| UUID | TEXT | not null |
8284
| category | TEXT | not null |
8385
| votes | INTEGER | not null, default 0 |
86+
| id | SERIAL | primary key
8487

8588
| index | field |
8689
| -- | :--: |
@@ -97,6 +100,7 @@
97100
| hashedVideoID | TEXT | not null, default '' |
98101
| reason | TEXT | not null, default '' |
99102
| service | TEXT | not null, default 'YouTube' |
103+
| id | SERIAL | primary key
100104

101105
| index | field |
102106
| -- | :--: |
@@ -111,6 +115,11 @@
111115
| issuerUserID | TEXT | not null |
112116
| enabled | INTEGER | not null |
113117
| reason | TEXT | not null, default '' |
118+
| type | INTEGER | default 0 |
119+
120+
| constraint | field |
121+
| -- | :--: |
122+
| PRIMARY KEY | userID, issueTime |
114123

115124
| index | field |
116125
| -- | :--: |
@@ -121,7 +130,7 @@
121130

122131
| Name | Type | |
123132
| -- | :--: | -- |
124-
| userID | TEXT | not null |
133+
| userID | TEXT | not null, primary key |
125134

126135
| index | field |
127136
| -- | :--: |
@@ -151,12 +160,13 @@
151160
| channelID | TEXT | not null |
152161
| timeSubmitted | INTEGER | not null |
153162
| service | TEXT | not null, default 'YouTube' |
163+
| id | SERIAL | primary key
154164

155165
### config
156166

157167
| Name | Type | |
158168
| -- | :--: | -- |
159-
| key | TEXT | not null, unique |
169+
| key | TEXT | not null, unique, primary key |
160170
| value | TEXT | not null |
161171

162172
### archivedSponsorTimes
@@ -169,7 +179,7 @@
169179
| votes | INTEGER | not null |
170180
| locked | INTEGER | not null, default '0' |
171181
| incorrectVotes | INTEGER | not null, default 1 |
172-
| UUID | TEXT | not null, unique |
182+
| UUID | TEXT | not null, unique, primary key |
173183
| userID | TEXT | not null |
174184
| timeSubmitted | INTEGER | not null |
175185
| views | INTEGER | not null |
@@ -182,6 +192,7 @@
182192
| shadowHidden | INTEGER | not null |
183193
| hashedVideoID | TEXT | not null, default '', sha256 |
184194
| userAgent | TEXT | not null, default '' |
195+
| description | TEXT | not null, default '' |
185196

186197
### ratings
187198

@@ -192,6 +203,7 @@
192203
| type | INTEGER | not null |
193204
| count | INTEGER | not null |
194205
| hashedVideoID | TEXT | not null |
206+
| id | SERIAL | primary key
195207

196208
| index | field |
197209
| -- | :--: |
@@ -200,13 +212,38 @@
200212
| ratings_videoID | videoID, service |
201213

202214
### userFeatures
215+
| userID | TEXT | not null |
216+
| feature | INTEGER | not null |
217+
| issuerUserID | TEXT | not null |
218+
| timeSubmitted | INTEGER | not null |
219+
220+
| constraint | field |
221+
| -- | :--: |
222+
| primary key | userID, feature |
203223

204224
| index | field |
205225
| -- | :--: |
206226
| userFeatures_userID | userID, feature |
207227

228+
### shadowBannedIPs
229+
230+
| Name | Type | |
231+
| -- | :--: | -- |
232+
| hashedIP | TEXT | not null, primary key |
233+
208234
### titles
209235

236+
| Name | Type | |
237+
| -- | :--: | -- |
238+
| videoID | TEXT | not null |
239+
| title | TEXT | not null |
240+
| original | INTEGER | default 0 |
241+
| userID | TEXT | not null
242+
| service | TEXT not null |
243+
| hashedVideoID | TEXT | not null |
244+
| timeSubmitted | INTEGER | not null |
245+
| UUID | TEXT | not null, primary key
246+
210247
| index | field |
211248
| -- | :--: |
212249
| titles_timeSubmitted | timeSubmitted |
@@ -215,19 +252,70 @@
215252
| titles_hashedVideoID_2 | service, hashedVideoID, timeSubmitted |
216253

217254
### titleVotes
255+
256+
| Name | Type | |
257+
| -- | :--: | -- |
258+
| UUID | TEXT | not null, primary key |
259+
| votes | INTEGER | not null, default 0 |
260+
| locked | INTEGER | not null, default 0 |
261+
| shadowHidden | INTEGER | not null, default 0 |
262+
| verification | INTEGER | default 0 |
263+
| downvotes | INTEGER | default 0 |
264+
| removed | INTEGER | default 0 |
265+
266+
| constraint | field |
267+
| -- | :--: |
268+
| foreign key | UUID references "titles"("UUID")
269+
218270
| index | field |
219271
| -- | :--: |
220272
| titleVotes_votes | UUID, votes
221273

222274
### thumbnails
275+
276+
| Name | Type | |
277+
| -- | :--: | -- |
278+
| UUID | TEXT | not null |
279+
| original | INTEGER | default 0 |
280+
| userID | TEXT | not null |
281+
| service | TEXT | not null |
282+
| hashedVideoID | TEXT | not null |
283+
| timeSubmitted | INTEGER | not null |
284+
| UUID | TEXT | not null, primary key |
285+
223286
| index | field |
224287
| -- | :--: |
225288
| thumbnails_timeSubmitted | timeSubmitted |
226289
| thumbnails_votes_timeSubmitted | videoID, service, userID, timeSubmitted |
227290
| thumbnails_videoID | videoID, service |
228291
| thumbnails_hashedVideoID_2 | service, hashedVideoID, timeSubmitted |
229292

293+
### thumbnailTimestamps
294+
295+
| index | field |
296+
| -- | :--: |
297+
| UUID | TEXT | not null, primary key
298+
| timestamp | INTEGER | not null, default 0
299+
300+
| constraint | field |
301+
| -- | :--: |
302+
| foreign key | UUID references "thumbnails"("UUID")
303+
230304
### thumbnailVotes
305+
306+
| index | field |
307+
| -- | :--: |
308+
| UUID | TEXT | not null, primary key |
309+
| votes | INTEGER | not null, default 0 |
310+
| locked | INTEGER |not null, default 0 |
311+
| shadowHidden | INTEGER | not null, default 0 |
312+
| downvotes | INTEGER | default 0 |
313+
| removed | INTEGER | default 0 |
314+
315+
| constraint | field |
316+
| -- | :--: |
317+
| foreign key | UUID references "thumbnails"("UUID")
318+
231319
| index | field |
232320
| -- | :--: |
233321
| thumbnailVotes_votes | UUID, votes

0 commit comments

Comments
 (0)