mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-11 20:32:12 +00:00
work on twitch database table schema
This commit is contained in:
1 parent
902ae9e5be
commit
367595f4e8
2 files changed
+36
-6
No files matched your search
+1
@@ -2,3 +2,4 @@
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
DROP TABLE twitch_oauth_tokens;
|
||||
+35
-6
@@ -10,17 +10,37 @@ CREATE TABLE twitch_oauth_tokens(
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- Foreign key to user (Vocodes/Storyteller user)
|
||||
-- ========== STORYTELLER/FAKEYOU USER ==========
|
||||
|
||||
-- Foreign key to user (Storyteller/FakeYou user)
|
||||
-- If no user is associated (anonymous Twitch user), then this is null.
|
||||
maybe_user_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- ========== TWITCH USER ==========
|
||||
|
||||
-- The user ID / channel ID are the same
|
||||
-- https://discuss.dev.twitch.tv/t/what-is-the-difference-between-the-stream--id-and-channel--id/4423
|
||||
maybe_twitch_user_id VARCHAR(32) DEFAULT NULL,
|
||||
twitch_user_id VARCHAR(32) NOT NULL,
|
||||
|
||||
-- Usernames are between 4 and 25 characters.
|
||||
maybe_twitch_username VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- ========== OAUTH TOKEN DETAILS ==========
|
||||
|
||||
-- The ever important OAuth access token.
|
||||
access_token VARCHAR(128) NOT NULL,
|
||||
|
||||
-- If we can refresh the token, this is the thing to use.
|
||||
maybe_refresh_token VARCHAR(128) DEFAULT NULL,
|
||||
|
||||
-- Should be "bearer". Included in the OAuth redemption.
|
||||
token_type VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- When the token expires from time of first grant.
|
||||
-- (We don't update this field.)
|
||||
-- Null if it does not expire or we were not informed
|
||||
expires_in_seconds INT(10) DEFAULT NULL,
|
||||
|
||||
-- ========== OAUTH SCOPES ==========
|
||||
|
||||
-- "bits:read"
|
||||
@@ -56,7 +76,11 @@ CREATE TABLE twitch_oauth_tokens(
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- This is when the OAuth token will expire. We need to refresh before this time.
|
||||
-- This is when the OAuth token will expire.
|
||||
-- While we need to refresh before this time, Twitch recommends against eager
|
||||
-- refreshes and instead wants the code to lazily refresh.
|
||||
-- This also has no bearing on the "refresh_token".
|
||||
-- We'll just use this for bookkeeping.
|
||||
expires_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
-- If the OAuth token is deleted, we set this.
|
||||
@@ -66,10 +90,15 @@ CREATE TABLE twitch_oauth_tokens(
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
KEY fk_maybe_user_token (maybe_user_token)
|
||||
KEY fk_maybe_user_token (maybe_user_token),
|
||||
KEY index_twitch_user_id (twitch_user_id),
|
||||
KEY index_maybe_twitch_username (maybe_twitch_username),
|
||||
KEY index_expires_at (expires_at),
|
||||
KEY index_user_deleted_at (user_deleted_at),
|
||||
KEY index_mod_deleted_at (mod_deleted_at)
|
||||
|
||||
--KEY index_has_bits_read (has_bits_read),
|
||||
--KEY index_creator_ip_address (creator_ip_address)
|
||||
-- KEY index_has_bits_read (has_bits_read),
|
||||
-- KEY index_creator_ip_address (creator_ip_address)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
|
||||
Reference in new issue
Block a user