SponsorBlockServer/DatabaseSchema.md

419 lines
10 KiB
Markdown
Raw Permalink Normal View History

2024-06-21 03:15:07 +02:00
# SponsorTimesDB
2021-06-25 05:44:08 +02:00
2024-06-21 01:34:15 +02:00
- [vipUsers](#vipusers)
- [sponsorTimes](#sponsortimes)
- [userNames](#usernames)
- [categoryVotes](#categoryvotes)
- [lockCategories](#lockcategories)
- [warnings](#warnings)
- [shadowBannedUsers](#shadowbannedusers)
- [videoInfo](#videoinfo)
- [unlistedVideos](#unlistedvideos)
- [config](#config)
- [archivedSponsorTimes](#archivedsponsortimes)
- [ratings](#ratings)
2024-06-21 01:34:25 +02:00
- [userFeatures](#userFeatures)
2024-06-21 03:08:38 +02:00
- [shadowBannedIPs](#shadowBannedIPs)
2024-06-21 01:34:25 +02:00
- [titles](#titles)
- [titleVotes](#titleVotes)
- [thumbnails](#thumbnails)
2024-06-21 03:08:38 +02:00
- [thumbnailTimestamps](#thumbnailTimestamps)
2024-06-21 01:34:25 +02:00
- [thumbnailVotes](#thumbnailVotes)
2021-06-25 05:44:08 +02:00
### vipUsers
| Name | Type | |
| -- | :--: | -- |
2024-06-21 03:08:38 +02:00
| userID | TEXT | not null, primary key |
2021-06-25 05:44:08 +02:00
| index | field |
| -- | :--: |
| vipUsers_index | userID |
### sponsorTimes
| Name | Type | |
| -- | :--: | -- |
| videoID | TEXT | not null |
| startTime | REAL | not null |
| endTime | REAL | not null |
| votes | INTEGER | not null |
2021-07-06 02:05:54 +02:00
| locked | INTEGER | not null, default '0' |
2021-06-25 05:44:08 +02:00
| incorrectVotes | INTEGER | not null, default 1 |
2024-06-21 03:08:38 +02:00
| UUID | TEXT | not null, unique, primary key |
2021-06-25 05:44:08 +02:00
| userID | TEXT | not null |
| timeSubmitted | INTEGER | not null |
| views | INTEGER | not null |
| category | TEXT | not null, default 'sponsor' |
2021-07-09 06:46:04 +02:00
| actionType | TEXT | not null, default 'skip' |
2021-09-30 08:56:55 +02:00
| service | TEXT | not null, default 'YouTube' |
2021-07-06 02:05:54 +02:00
| videoDuration | INTEGER | not null, default '0' |
| hidden | INTEGER | not null, default '0' |
| reputation | REAL | not null, default '0' |
2021-06-25 05:44:08 +02:00
| shadowHidden | INTEGER | not null |
| hashedVideoID | TEXT | not null, default '', sha256 |
2021-07-30 08:44:37 +02:00
| userAgent | TEXT | not null, default '' |
2021-11-07 00:56:01 +01:00
| description | TEXT | not null, default '' |
2021-06-25 05:44:08 +02:00
| index | field |
| -- | :--: |
| sponsorTime_timeSubmitted | timeSubmitted |
| sponsorTime_userID | userID |
| sponsorTimes_UUID | UUID |
2024-06-21 01:34:25 +02:00
| sponsorTimes_hashedVideoID | service, hashedVideoID, startTime |
| sponsorTimes_videoID | service, videoID, startTime |
| sponsorTimes_videoID_category | videoID, category |
| sponsorTimes_description_gin | description, category |
2021-06-25 05:44:08 +02:00
### userNames
| Name | Type | |
| -- | :--: | -- |
2024-06-21 03:08:38 +02:00
| userID | TEXT | not null, primary key |
2021-06-25 05:44:08 +02:00
| userName | TEXT | not null |
| locked | INTEGER | not nul, default '0' |
| index | field |
| -- | :--: |
| userNames_userID | userID |
### categoryVotes
| Name | Type | |
| -- | :--: | -- |
| UUID | TEXT | not null |
| category | TEXT | not null |
| votes | INTEGER | not null, default 0 |
2024-06-21 03:08:38 +02:00
| id | SERIAL | primary key
2021-06-25 05:44:08 +02:00
| index | field |
| -- | :--: |
| categoryVotes_UUID_public | UUID, category |
### lockCategories
| Name | Type | |
| -- | :--: | -- |
| videoID | TEXT | not null |
| userID | TEXT | not null |
2022-01-02 20:00:54 +01:00
| actionType | TEXT | not null, default 'skip' |
2021-06-25 05:44:08 +02:00
| category | TEXT | not null |
2021-07-06 02:05:54 +02:00
| hashedVideoID | TEXT | not null, default '' |
2021-07-06 08:31:44 +02:00
| reason | TEXT | not null, default '' |
2021-09-30 08:56:55 +02:00
| service | TEXT | not null, default 'YouTube' |
2024-06-21 03:08:38 +02:00
| id | SERIAL | primary key
2021-06-25 05:44:08 +02:00
| index | field |
| -- | :--: |
2021-09-30 08:56:55 +02:00
| lockCategories_videoID | videoID, service, category |
2021-06-25 05:44:08 +02:00
### warnings
| Name | Type | |
| -- | :--: | -- |
| userID | TEXT | not null |
| issueTime | INTEGER | not null |
| issuerUserID | TEXT | not null |
| enabled | INTEGER | not null |
2021-06-29 09:56:57 +02:00
| reason | TEXT | not null, default '' |
2024-06-21 03:08:38 +02:00
| type | INTEGER | default 0 |
| constraint | field |
| -- | :--: |
| PRIMARY KEY | userID, issueTime |
2021-06-25 05:44:08 +02:00
| index | field |
| -- | :--: |
2024-06-21 01:34:25 +02:00
| warnings_index | userID, issueTime, enabled |
2021-06-25 05:44:08 +02:00
| warnings_issueTime | issueTime |
### shadowBannedUsers
| Name | Type | |
| -- | :--: | -- |
2024-06-21 03:08:38 +02:00
| userID | TEXT | not null, primary key |
2021-06-25 05:44:08 +02:00
| index | field |
| -- | :--: |
| shadowBannedUsers_index | userID |
### videoInfo
| Name | Type | |
| -- | :--: | -- |
| videoID | TEXT | not null |
| channelID | TEXT | not null |
| title | TEXT | not null |
| published | REAL | not null |
| index | field |
| -- | :--: |
2024-06-21 01:34:25 +02:00
| videoInfo_videoID | videoID |
| videoInfo_channelID | channelID |
2021-06-25 05:44:08 +02:00
### unlistedVideos
| Name | Type | |
| -- | :--: | -- |
| videoID | TEXT | not null |
| year | TEXT | not null |
| views | TEXT | not null |
| channelID | TEXT | not null |
| timeSubmitted | INTEGER | not null |
2021-09-30 08:56:55 +02:00
| service | TEXT | not null, default 'YouTube' |
2024-06-21 03:08:38 +02:00
| id | SERIAL | primary key
2021-06-25 05:44:08 +02:00
### config
| Name | Type | |
| -- | :--: | -- |
2024-06-21 03:08:38 +02:00
| key | TEXT | not null, unique, primary key |
2021-06-25 05:44:08 +02:00
| value | TEXT | not null |
2021-07-09 06:46:04 +02:00
### archivedSponsorTimes
2021-06-25 05:44:08 +02:00
2021-07-09 06:46:04 +02:00
| Name | Type | |
| -- | :--: | -- |
| videoID | TEXT | not null |
| startTime | REAL | not null |
| endTime | REAL | not null |
| votes | INTEGER | not null |
| locked | INTEGER | not null, default '0' |
| incorrectVotes | INTEGER | not null, default 1 |
2024-06-21 03:08:38 +02:00
| UUID | TEXT | not null, unique, primary key |
2021-07-09 06:46:04 +02:00
| userID | TEXT | not null |
| timeSubmitted | INTEGER | not null |
| views | INTEGER | not null |
| category | TEXT | not null, default 'sponsor' |
| actionType | TEXT | not null, default 'skip' |
2021-09-30 08:56:55 +02:00
| service | TEXT | not null, default 'YouTube' |
2021-07-09 06:46:04 +02:00
| videoDuration | INTEGER | not null, default '0' |
| hidden | INTEGER | not null, default '0' |
| reputation | REAL | not null, default '0' |
| shadowHidden | INTEGER | not null |
| hashedVideoID | TEXT | not null, default '', sha256 |
2021-07-30 08:44:37 +02:00
| userAgent | TEXT | not null, default '' |
2024-06-21 03:08:38 +02:00
| description | TEXT | not null, default '' |
2021-06-25 05:44:08 +02:00
### ratings
| Name | Type | |
| -- | :--: | -- |
| videoID | TEXT | not null |
| service | TEXT | not null, default 'YouTube' |
| type | INTEGER | not null |
| count | INTEGER | not null |
| hashedVideoID | TEXT | not null |
2024-06-21 03:08:38 +02:00
| id | SERIAL | primary key
| index | field |
| -- | :--: |
| ratings_hashedVideoID_gin | hashedVideoID |
| ratings_hashedVideoID | hashedVideoID, service |
| ratings_videoID | videoID, service |
2024-06-21 01:34:25 +02:00
### userFeatures
2024-06-21 03:17:31 +02:00
| Name | Type | |
| -- | :--: | -- |
2024-06-21 03:08:38 +02:00
| userID | TEXT | not null |
| feature | INTEGER | not null |
| issuerUserID | TEXT | not null |
| timeSubmitted | INTEGER | not null |
| constraint | field |
| -- | :--: |
| primary key | userID, feature |
2024-06-21 01:34:25 +02:00
| index | field |
| -- | :--: |
| userFeatures_userID | userID, feature |
2024-06-21 03:08:38 +02:00
### shadowBannedIPs
| Name | Type | |
| -- | :--: | -- |
| hashedIP | TEXT | not null, primary key |
2024-06-21 01:34:25 +02:00
### titles
2024-06-21 03:08:38 +02:00
| Name | Type | |
| -- | :--: | -- |
| videoID | TEXT | not null |
| title | TEXT | not null |
| original | INTEGER | default 0 |
| userID | TEXT | not null
2024-06-24 03:14:05 +02:00
| service | TEXT | not null |
2024-06-21 03:08:38 +02:00
| hashedVideoID | TEXT | not null |
| timeSubmitted | INTEGER | not null |
| UUID | TEXT | not null, primary key
2024-06-21 01:34:25 +02:00
| index | field |
| -- | :--: |
| titles_timeSubmitted | timeSubmitted |
| titles_userID_timeSubmitted | videoID, service, userID, timeSubmitted |
| titles_videoID | videoID, service |
| titles_hashedVideoID_2 | service, hashedVideoID, timeSubmitted |
### titleVotes
2024-06-21 03:08:38 +02:00
| Name | Type | |
| -- | :--: | -- |
| UUID | TEXT | not null, primary key |
| votes | INTEGER | not null, default 0 |
| locked | INTEGER | not null, default 0 |
| shadowHidden | INTEGER | not null, default 0 |
| verification | INTEGER | default 0 |
| downvotes | INTEGER | default 0 |
| removed | INTEGER | default 0 |
| constraint | field |
| -- | :--: |
| foreign key | UUID references "titles"("UUID")
2024-06-21 01:34:25 +02:00
| index | field |
| -- | :--: |
| titleVotes_votes | UUID, votes
### thumbnails
2024-06-21 03:08:38 +02:00
| Name | Type | |
| -- | :--: | -- |
| original | INTEGER | default 0 |
| userID | TEXT | not null |
| service | TEXT | not null |
| hashedVideoID | TEXT | not null |
| timeSubmitted | INTEGER | not null |
| UUID | TEXT | not null, primary key |
2024-06-21 01:34:25 +02:00
| index | field |
| -- | :--: |
| thumbnails_timeSubmitted | timeSubmitted |
| thumbnails_votes_timeSubmitted | videoID, service, userID, timeSubmitted |
| thumbnails_videoID | videoID, service |
| thumbnails_hashedVideoID_2 | service, hashedVideoID, timeSubmitted |
2024-06-21 03:08:38 +02:00
### thumbnailTimestamps
| index | field |
| -- | :--: |
| UUID | TEXT | not null, primary key
| timestamp | INTEGER | not null, default 0
| constraint | field |
| -- | :--: |
| foreign key | UUID references "thumbnails"("UUID")
2024-06-21 01:34:25 +02:00
### thumbnailVotes
2024-06-21 03:08:38 +02:00
2024-06-24 03:14:05 +02:00
| Name | Type | |
| -- | :--: | -- |
2024-06-21 03:08:38 +02:00
| UUID | TEXT | not null, primary key |
| votes | INTEGER | not null, default 0 |
| locked | INTEGER |not null, default 0 |
| shadowHidden | INTEGER | not null, default 0 |
| downvotes | INTEGER | default 0 |
| removed | INTEGER | default 0 |
| constraint | field |
| -- | :--: |
| foreign key | UUID references "thumbnails"("UUID")
2024-06-21 01:34:25 +02:00
| index | field |
| -- | :--: |
| thumbnailVotes_votes | UUID, votes
2021-06-25 05:44:08 +02:00
# Private
2024-06-21 01:34:15 +02:00
- [votes](#votes)
- [categoryVotes](#categoryVotes)
- [sponsorTimes](#sponsorTimes)
- [config](#config)
- [ratings](#ratings)
- [tempVipLog](#tempVipLog)
- [userNameLogs](#userNameLogs)
2021-06-25 05:44:08 +02:00
2022-05-10 20:04:25 +02:00
### votes
2021-06-25 05:44:08 +02:00
| Name | Type | |
| -- | :--: | -- |
| UUID | TEXT | not null |
| userID | TEXT | not null |
| hashedIP | TEXT | not null |
| type | INTEGER | not null |
2022-07-04 22:18:58 +02:00
| 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
2024-06-21 03:11:28 +02:00
| id | SERIAL | primary key |
2021-06-25 05:44:08 +02:00
| index | field |
| -- | :--: |
| votes_userID | UUID |
### categoryVotes
| Name | Type | |
| -- | :--: | -- |
| UUID | TEXT | not null |
| userID | TEXT | not null |
| hashedIP | TEXT | not null |
| category | TEXT | not null |
| timeSubmitted | INTEGER | not null |
2024-06-21 03:11:28 +02:00
| id | SERIAL | primary key |
2021-06-25 05:44:08 +02:00
| index | field |
| -- | :--: |
2024-06-21 01:35:38 +02:00
| categoryVotes_UUID | UUID, userID, hashedIP, category |
2021-06-25 05:44:08 +02:00
### sponsorTimes
| Name | Type | |
| -- | :--: | -- |
| videoID | TEXT | not null |
| hashedIP | TEXT | not null |
| timeSubmitted | INTEGER | not null |
2021-09-30 08:56:55 +02:00
| service | TEXT | not null, default 'YouTube' |
2024-06-21 03:11:28 +02:00
| id | SERIAL | primary key |
2021-06-25 05:44:08 +02:00
| index | field |
| -- | :--: |
2024-06-21 01:35:38 +02:00
| privateDB_sponsorTimes_v4 | videoID, service, timeSubmitted |
2021-06-25 05:44:08 +02:00
### config
| Name | Type | |
| -- | :--: | -- |
2024-06-21 03:11:28 +02:00
| key | TEXT | not null, primary key |
| value | TEXT | not null |
### ratings
| Name | Type | |
| -- | :--: | -- |
| videoID | TEXT | not null |
| service | TEXT | not null, default 'YouTube' |
| userID | TEXT | not null |
| type | INTEGER | not null |
| timeSubmitted | INTEGER | not null |
| hashedIP | TEXT | not null |
2024-06-21 03:11:28 +02:00
| id | SERIAL | primary key |
| index | field |
| -- | :--: |
| ratings_videoID | videoID, service, userID, timeSubmitted |
2021-12-31 10:26:37 +01:00
### tempVipLog
| Name | Type | |
| -- | :--: | -- |
| issuerUserID | TEXT | not null |
| targetUserID | TEXT | not null |
| enabled | BOOLEAN | not null |
2022-05-10 19:50:41 +02:00
| updatedAt | INTEGER | not null |
2024-06-21 03:11:28 +02:00
| id | SERIAL | primary key |
2022-05-10 19:50:41 +02:00
### userNameLogs
| Name | Type | |
| -- | :--: | -- |
| userID | TEXT | not null |
| newUserName | TEXT | not null |
| oldUserName | TEXT | not null |
| updatedByAdmin | BOOLEAN | not null |
2024-06-21 03:11:28 +02:00
| updatedAt | INTEGER | not null |
| id | SERIAL | primary key |