Twitch user configs (first iteration)

This commit is contained in:
Brandon Thomas committed 2022-02-13 19:20:23 -05:00
1 parent e2eb288fa8
commit 3528359d74
4 files changed
+84

No files matched your search

@@ -0,0 +1,5 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE twitch_event_action_rules;
@@ -0,0 +1,44 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- Multiple rows per user
CREATE TABLE twitch_event_action_rules(
-- Not used for anything except replication.
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
token VARCHAR(32) NOT NULL,
-- Foreign key to user
-- This is a FakeYou/Storyteller account, *NOT* a twitch user id.
user_token VARCHAR(32) NOT NULL,
-- The user can rearrange the rules in the UI.
-- This will be the order they apply in if matched.
-- NB: There is nothing in MySQL to guarantee unique ordering.
user_specified_rule_order INT(10) UNSIGNED NOT NULL DEFAULT 0,
-- What type of event we'll be responding to.
event_category ENUM(
'bits',
'channel_points',
'chat_command'
) NOT NULL,
-- A JSON payload containing any predicates we wish to apply to the match.
-- eg. bits_value > 100
-- eg. channel_points_award_name == "Mario Voice"
event_match_predicate MEDIUMTEXT NOT NULL,
-- A JSON payload containing how we wish to respond to the event.
-- eg. tts M:model
event_response MEDIUMTEXT NOT NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (token),
KEY fk_user_token (user_token),
KEY index_event_category (event_category)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -0,0 +1,5 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE twitch_general_settings;
@@ -0,0 +1,30 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- One row per user. Contains all of the general (non-repeated) configs.
CREATE TABLE twitch_general_settings (
-- Not used for anything except replication.
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-- Foreign key to user
-- This is a FakeYou/Storyteller account, *NOT* a twitch user id.
user_token VARCHAR(32) NOT NULL,
-- Kill switch for the entire service.
storyteller_is_enabled BOOLEAN NOT NULL DEFAULT FALSE,
-- Kill switch for TTS.
tts_is_enabled BOOLEAN NOT NULL DEFAULT FALSE,
-- Kill switch for W2L.
w2l_is_enabled BOOLEAN NOT NULL DEFAULT FALSE,
-- Can set a fallback voice if a TTS voice goes missing.
maybe_fallback_tts_model_token VARCHAR(32) DEFAULT NULL,
-- INDICES --
PRIMARY KEY (id),
UNIQUE KEY (user_token)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;