|
1 | 1 | # SponsorTimesDB
|
2 | 2 |
|
3 |
| -[vipUsers](#vipUsers) |
4 |
| -[sponsorTimes](#sponsorTimes) |
5 |
| -[userNames](#userNames) |
6 |
| -[categoryVotes](#categoryVotes) |
7 |
| -[lockCategories](#lockCategories) |
8 |
| -[warnings](#warnings) |
9 |
| -[shadowBannedUsers](#shadowBannedUsers) |
10 |
| -[unlistedVideos](#unlistedVideos) |
11 |
| -[config](#config) |
12 |
| -[archivedSponsorTimes](#archivedSponsorTimes) |
| 3 | +- [vipUsers](#vipusers) |
| 4 | +- [sponsorTimes](#sponsortimes) |
| 5 | +- [userNames](#usernames) |
| 6 | +- [categoryVotes](#categoryvotes) |
| 7 | +- [lockCategories](#lockcategories) |
| 8 | +- [warnings](#warnings) |
| 9 | +- [shadowBannedUsers](#shadowbannedusers) |
| 10 | +- [videoInfo](#videoinfo) |
| 11 | +- [unlistedVideos](#unlistedvideos) |
| 12 | +- [config](#config) |
| 13 | +- [archivedSponsorTimes](#archivedsponsortimes) |
| 14 | +- [ratings](#ratings) |
| 15 | +- [userFeatures](#userFeatures) |
| 16 | +- [shadowBannedIPs](#shadowBannedIPs) |
| 17 | +- [titles](#titles) |
| 18 | +- [titleVotes](#titleVotes) |
| 19 | +- [thumbnails](#thumbnails) |
| 20 | +- [thumbnailTimestamps](#thumbnailTimestamps) |
| 21 | +- [thumbnailVotes](#thumbnailVotes) |
13 | 22 |
|
14 | 23 | ### vipUsers
|
15 | 24 | | Name | Type | |
|
16 | 25 | | -- | :--: | -- |
|
17 |
| -| userID | TEXT | not null | |
| 26 | +| userID | TEXT | not null, primary key | |
18 | 27 |
|
19 | 28 | | index | field |
|
20 | 29 | | -- | :--: |
|
|
30 | 39 | | votes | INTEGER | not null |
|
31 | 40 | | locked | INTEGER | not null, default '0' |
|
32 | 41 | | incorrectVotes | INTEGER | not null, default 1 |
|
33 |
| -| UUID | TEXT | not null, unique | |
| 42 | +| UUID | TEXT | not null, unique, primary key | |
34 | 43 | | userID | TEXT | not null |
|
35 | 44 | | timeSubmitted | INTEGER | not null |
|
36 | 45 | | views | INTEGER | not null |
|
|
50 | 59 | | sponsorTime_timeSubmitted | timeSubmitted |
|
51 | 60 | | sponsorTime_userID | userID |
|
52 | 61 | | sponsorTimes_UUID | UUID |
|
53 |
| -| sponsorTimes_hashedVideoID | hashedVideoID, category | |
54 |
| -| sponsorTimes_videoID | videoID, service, category, timeSubmitted | |
| 62 | +| sponsorTimes_hashedVideoID | service, hashedVideoID, startTime | |
| 63 | +| sponsorTimes_videoID | service, videoID, startTime | |
| 64 | +| sponsorTimes_videoID_category | videoID, category | |
| 65 | +| sponsorTimes_description_gin | description, category | |
55 | 66 |
|
56 | 67 | ### userNames
|
57 | 68 |
|
58 | 69 | | Name | Type | |
|
59 | 70 | | -- | :--: | -- |
|
60 |
| -| userID | TEXT | not null | |
| 71 | +| userID | TEXT | not null, primary key | |
61 | 72 | | userName | TEXT | not null |
|
62 | 73 | | locked | INTEGER | not nul, default '0' |
|
63 | 74 |
|
|
72 | 83 | | UUID | TEXT | not null |
|
73 | 84 | | category | TEXT | not null |
|
74 | 85 | | votes | INTEGER | not null, default 0 |
|
| 86 | +| id | SERIAL | primary key |
75 | 87 |
|
76 | 88 | | index | field |
|
77 | 89 | | -- | :--: |
|
|
88 | 100 | | hashedVideoID | TEXT | not null, default '' |
|
89 | 101 | | reason | TEXT | not null, default '' |
|
90 | 102 | | service | TEXT | not null, default 'YouTube' |
|
| 103 | +| id | SERIAL | primary key |
91 | 104 |
|
92 | 105 | | index | field |
|
93 | 106 | | -- | :--: |
|
|
102 | 115 | | issuerUserID | TEXT | not null |
|
103 | 116 | | enabled | INTEGER | not null |
|
104 | 117 | | reason | TEXT | not null, default '' |
|
| 118 | +| type | INTEGER | default 0 | |
| 119 | + |
| 120 | +| constraint | field | |
| 121 | +| -- | :--: | |
| 122 | +| PRIMARY KEY | userID, issueTime | |
105 | 123 |
|
106 | 124 | | index | field |
|
107 | 125 | | -- | :--: |
|
108 |
| -| warnings_index | userID | |
| 126 | +| warnings_index | userID, issueTime, enabled | |
109 | 127 | | warnings_issueTime | issueTime |
|
110 | 128 |
|
111 | 129 | ### shadowBannedUsers
|
112 | 130 |
|
113 | 131 | | Name | Type | |
|
114 | 132 | | -- | :--: | -- |
|
115 |
| -| userID | TEXT | not null | |
| 133 | +| userID | TEXT | not null, primary key | |
116 | 134 |
|
117 | 135 | | index | field |
|
118 | 136 | | -- | :--: |
|
|
129 | 147 |
|
130 | 148 | | index | field |
|
131 | 149 | | -- | :--: |
|
132 |
| -| videoInfo_videoID | timeSubmitted | |
133 |
| -| videoInfo_channelID | userID | |
| 150 | +| videoInfo_videoID | videoID | |
| 151 | +| videoInfo_channelID | channelID | |
134 | 152 |
|
135 | 153 | ### unlistedVideos
|
136 | 154 |
|
|
142 | 160 | | channelID | TEXT | not null |
|
143 | 161 | | timeSubmitted | INTEGER | not null |
|
144 | 162 | | service | TEXT | not null, default 'YouTube' |
|
| 163 | +| id | SERIAL | primary key |
145 | 164 |
|
146 | 165 | ### config
|
147 | 166 |
|
148 | 167 | | Name | Type | |
|
149 | 168 | | -- | :--: | -- |
|
150 |
| -| key | TEXT | not null, unique | |
| 169 | +| key | TEXT | not null, unique, primary key | |
151 | 170 | | value | TEXT | not null |
|
152 | 171 |
|
153 | 172 | ### archivedSponsorTimes
|
|
160 | 179 | | votes | INTEGER | not null |
|
161 | 180 | | locked | INTEGER | not null, default '0' |
|
162 | 181 | | incorrectVotes | INTEGER | not null, default 1 |
|
163 |
| -| UUID | TEXT | not null, unique | |
| 182 | +| UUID | TEXT | not null, unique, primary key | |
164 | 183 | | userID | TEXT | not null |
|
165 | 184 | | timeSubmitted | INTEGER | not null |
|
166 | 185 | | views | INTEGER | not null |
|
|
173 | 192 | | shadowHidden | INTEGER | not null |
|
174 | 193 | | hashedVideoID | TEXT | not null, default '', sha256 |
|
175 | 194 | | userAgent | TEXT | not null, default '' |
|
| 195 | +| description | TEXT | not null, default '' | |
176 | 196 |
|
177 | 197 | ### ratings
|
178 | 198 |
|
|
183 | 203 | | type | INTEGER | not null |
|
184 | 204 | | count | INTEGER | not null |
|
185 | 205 | | hashedVideoID | TEXT | not null |
|
| 206 | +| id | SERIAL | primary key |
186 | 207 |
|
187 | 208 | | index | field |
|
188 | 209 | | -- | :--: |
|
189 | 210 | | ratings_hashedVideoID_gin | hashedVideoID |
|
190 | 211 | | ratings_hashedVideoID | hashedVideoID, service |
|
191 | 212 | | ratings_videoID | videoID, service |
|
192 | 213 |
|
| 214 | +### userFeatures |
| 215 | +| Name | Type | | |
| 216 | +| -- | :--: | -- | |
| 217 | +| userID | TEXT | not null | |
| 218 | +| feature | INTEGER | not null | |
| 219 | +| issuerUserID | TEXT | not null | |
| 220 | +| timeSubmitted | INTEGER | not null | |
| 221 | + |
| 222 | +| constraint | field | |
| 223 | +| -- | :--: | |
| 224 | +| primary key | userID, feature | |
| 225 | + |
| 226 | +| index | field | |
| 227 | +| -- | :--: | |
| 228 | +| userFeatures_userID | userID, feature | |
| 229 | + |
| 230 | +### shadowBannedIPs |
| 231 | + |
| 232 | +| Name | Type | | |
| 233 | +| -- | :--: | -- | |
| 234 | +| hashedIP | TEXT | not null, primary key | |
| 235 | + |
| 236 | +### titles |
| 237 | + |
| 238 | +| Name | Type | | |
| 239 | +| -- | :--: | -- | |
| 240 | +| videoID | TEXT | not null | |
| 241 | +| title | TEXT | not null | |
| 242 | +| original | INTEGER | default 0 | |
| 243 | +| userID | TEXT | not null |
| 244 | +| service | TEXT not null | |
| 245 | +| hashedVideoID | TEXT | not null | |
| 246 | +| timeSubmitted | INTEGER | not null | |
| 247 | +| UUID | TEXT | not null, primary key |
| 248 | + |
| 249 | +| index | field | |
| 250 | +| -- | :--: | |
| 251 | +| titles_timeSubmitted | timeSubmitted | |
| 252 | +| titles_userID_timeSubmitted | videoID, service, userID, timeSubmitted | |
| 253 | +| titles_videoID | videoID, service | |
| 254 | +| titles_hashedVideoID_2 | service, hashedVideoID, timeSubmitted | |
| 255 | + |
| 256 | +### titleVotes |
| 257 | + |
| 258 | +| Name | Type | | |
| 259 | +| -- | :--: | -- | |
| 260 | +| UUID | TEXT | not null, primary key | |
| 261 | +| votes | INTEGER | not null, default 0 | |
| 262 | +| locked | INTEGER | not null, default 0 | |
| 263 | +| shadowHidden | INTEGER | not null, default 0 | |
| 264 | +| verification | INTEGER | default 0 | |
| 265 | +| downvotes | INTEGER | default 0 | |
| 266 | +| removed | INTEGER | default 0 | |
| 267 | + |
| 268 | +| constraint | field | |
| 269 | +| -- | :--: | |
| 270 | +| foreign key | UUID references "titles"("UUID") |
| 271 | + |
| 272 | +| index | field | |
| 273 | +| -- | :--: | |
| 274 | +| titleVotes_votes | UUID, votes |
| 275 | + |
| 276 | +### thumbnails |
| 277 | + |
| 278 | +| Name | Type | | |
| 279 | +| -- | :--: | -- | |
| 280 | +| UUID | TEXT | not null | |
| 281 | +| original | INTEGER | default 0 | |
| 282 | +| userID | TEXT | not null | |
| 283 | +| service | TEXT | not null | |
| 284 | +| hashedVideoID | TEXT | not null | |
| 285 | +| timeSubmitted | INTEGER | not null | |
| 286 | +| UUID | TEXT | not null, primary key | |
| 287 | + |
| 288 | +| index | field | |
| 289 | +| -- | :--: | |
| 290 | +| thumbnails_timeSubmitted | timeSubmitted | |
| 291 | +| thumbnails_votes_timeSubmitted | videoID, service, userID, timeSubmitted | |
| 292 | +| thumbnails_videoID | videoID, service | |
| 293 | +| thumbnails_hashedVideoID_2 | service, hashedVideoID, timeSubmitted | |
| 294 | + |
| 295 | +### thumbnailTimestamps |
| 296 | + |
| 297 | +| index | field | |
| 298 | +| -- | :--: | |
| 299 | +| UUID | TEXT | not null, primary key |
| 300 | +| timestamp | INTEGER | not null, default 0 |
| 301 | + |
| 302 | +| constraint | field | |
| 303 | +| -- | :--: | |
| 304 | +| foreign key | UUID references "thumbnails"("UUID") |
| 305 | + |
| 306 | +### thumbnailVotes |
| 307 | + |
| 308 | +| index | field | |
| 309 | +| -- | :--: | |
| 310 | +| UUID | TEXT | not null, primary key | |
| 311 | +| votes | INTEGER | not null, default 0 | |
| 312 | +| locked | INTEGER |not null, default 0 | |
| 313 | +| shadowHidden | INTEGER | not null, default 0 | |
| 314 | +| downvotes | INTEGER | default 0 | |
| 315 | +| removed | INTEGER | default 0 | |
| 316 | + |
| 317 | +| constraint | field | |
| 318 | +| -- | :--: | |
| 319 | +| foreign key | UUID references "thumbnails"("UUID") |
| 320 | + |
| 321 | +| index | field | |
| 322 | +| -- | :--: | |
| 323 | +| thumbnailVotes_votes | UUID, votes |
| 324 | + |
193 | 325 | # Private
|
194 | 326 |
|
195 |
| -[votes](#votes) |
196 |
| -[categoryVotes](#categoryVotes) |
197 |
| -[sponsorTimes](#sponsorTimes) |
198 |
| -[config](#config) |
199 |
| -[ratings](#ratings) |
200 |
| -[tempVipLog](#tempVipLog) |
201 |
| -[userNameLogs](#userNameLogs) |
| 327 | +- [votes](#votes) |
| 328 | +- [categoryVotes](#categoryVotes) |
| 329 | +- [sponsorTimes](#sponsorTimes) |
| 330 | +- [config](#config) |
| 331 | +- [ratings](#ratings) |
| 332 | +- [tempVipLog](#tempVipLog) |
| 333 | +- [userNameLogs](#userNameLogs) |
202 | 334 |
|
203 | 335 | ### votes
|
204 | 336 |
|
|
209 | 341 | | hashedIP | TEXT | not null |
|
210 | 342 | | type | INTEGER | not null |
|
211 | 343 | | originalVoteType | INTEGER | not null | # Since type was reused to also specify the number of votes removed when less than 0, this is being used for the actual type
|
| 344 | +| id | SERIAL | primary key | |
212 | 345 |
|
213 | 346 | | index | field |
|
214 | 347 | | -- | :--: |
|
|
223 | 356 | | hashedIP | TEXT | not null |
|
224 | 357 | | category | TEXT | not null |
|
225 | 358 | | timeSubmitted | INTEGER | not null |
|
| 359 | +| id | SERIAL | primary key | |
226 | 360 |
|
227 | 361 | | index | field |
|
228 | 362 | | -- | :--: |
|
229 |
| -| categoryVotes_UUID | UUID, userID, hasedIP, category | |
| 363 | +| categoryVotes_UUID | UUID, userID, hashedIP, category | |
230 | 364 |
|
231 | 365 | ### sponsorTimes
|
232 | 366 |
|
|
236 | 370 | | hashedIP | TEXT | not null |
|
237 | 371 | | timeSubmitted | INTEGER | not null |
|
238 | 372 | | service | TEXT | not null, default 'YouTube' |
|
| 373 | +| id | SERIAL | primary key | |
239 | 374 |
|
240 | 375 | | index | field |
|
241 | 376 | | -- | :--: |
|
242 |
| -| sponsorTimes_hashedIP | hashedIP | |
243 |
| -| privateDB_sponsorTimes_videoID_v2 | videoID, service | |
| 377 | +| privateDB_sponsorTimes_v4 | videoID, service, timeSubmitted | |
244 | 378 |
|
245 | 379 | ### config
|
246 | 380 |
|
247 | 381 | | Name | Type | |
|
248 | 382 | | -- | :--: | -- |
|
249 |
| -| key | TEXT | not null | |
| 383 | +| key | TEXT | not null, primary key | |
250 | 384 | | value | TEXT | not null |
|
251 | 385 |
|
252 | 386 | ### ratings
|
|
259 | 393 | | type | INTEGER | not null |
|
260 | 394 | | timeSubmitted | INTEGER | not null |
|
261 | 395 | | hashedIP | TEXT | not null |
|
| 396 | +| id | SERIAL | primary key | |
262 | 397 |
|
263 | 398 | | index | field |
|
264 | 399 | | -- | :--: |
|
|
271 | 406 | | targetUserID | TEXT | not null |
|
272 | 407 | | enabled | BOOLEAN | not null |
|
273 | 408 | | updatedAt | INTEGER | not null |
|
| 409 | +| id | SERIAL | primary key | |
274 | 410 |
|
275 | 411 | ### userNameLogs
|
276 | 412 |
|
|
281 | 417 | | oldUserName | TEXT | not null |
|
282 | 418 | | updatedByAdmin | BOOLEAN | not null |
|
283 | 419 | | updatedAt | INTEGER | not null |
|
| 420 | +| id | SERIAL | primary key | |
0 commit comments