new tables
This commit is contained in:
parent
4485cf34d4
commit
342f9cd10e
|
|
@ -10,25 +10,6 @@ CREATE TABLE firehose_entries (
|
|||
token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- The type of the event
|
||||
-- DO NOT REORDER.
|
||||
-- event_type ENUM(
|
||||
-- 'not-set',
|
||||
-- 'user_sign_up',
|
||||
-- 'tts_model_upload_started',
|
||||
-- 'tts_model_upload_completed',
|
||||
-- 'tts_inference_started',
|
||||
-- 'tts_inference_completed',
|
||||
-- 'w2l_template_upload_started',
|
||||
-- 'w2l_template_upload_completed',
|
||||
-- 'w2l_inference_started',
|
||||
-- 'w2l_inference_completed',
|
||||
-- 'twitter_mention',
|
||||
-- 'twitter_retweet',
|
||||
-- 'discord_join',
|
||||
-- 'discord_message',
|
||||
-- 'twitch_subscribe',
|
||||
-- 'twitch_follow'
|
||||
-- ) NOT NULL DEFAULT 'not-set',
|
||||
event_type VARCHAR(32) NOT NULL,
|
||||
|
||||
-- The target user
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
drop table ip_address_bans;
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
CREATE TABLE ip_address_bans (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- The IP address to ban
|
||||
ip_address VARCHAR(40) DEFAULT NULL,
|
||||
|
||||
-- Mod who created or last edited the ban.
|
||||
mod_user_token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- Maybe the target user.
|
||||
maybe_target_user_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- Optional notes about the ban.
|
||||
notes TEXT DEFAULT NULL,
|
||||
|
||||
-- Moderator can set an expire time (optional).
|
||||
-- If not set, the ban is indefinite
|
||||
expires_at TIMESTAMP DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- If deleted, the ban is removed.
|
||||
deleted_at TIMESTAMP DEFAULT NULL,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (ip_address),
|
||||
KEY fk_mod_user_token (mod_user_token),
|
||||
KEY fk_maybe_target_user_token (maybe_target_user_token)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
drop table moderator_audit_log_entries;
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
-- noinspection SqlDialectInspectionForFile
|
||||
-- noinspection SqlNoDataSourceInspectionForFile
|
||||
-- noinspection SqlResolveForFile
|
||||
|
||||
CREATE TABLE moderator_audit_logs_entries (
|
||||
-- Not used for anything except replication.
|
||||
id BIGINT(20) NOT NULL AUTO_INCREMENT,
|
||||
|
||||
-- Visible "primary key"
|
||||
token VARCHAR(32) NOT NULL,
|
||||
|
||||
-- The type of the event (ban, delete, etc.)
|
||||
event_type VARCHAR(32) NOT NULL,
|
||||
|
||||
-- The target user
|
||||
maybe_target_user_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- The target "entity", which varies by event type.
|
||||
-- eg. a model token or template token
|
||||
maybe_target_entity_token VARCHAR(32) DEFAULT NULL,
|
||||
|
||||
-- If an IP was banned, we record it here.
|
||||
maybe_target_ip_address VARCHAR(40) DEFAULT NULL,
|
||||
|
||||
-- Optional mod-specified notes.
|
||||
optional_notes TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
|
||||
-- INDICES --
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY (token),
|
||||
KEY fk_maybe_target_user_token (maybe_target_user_token),
|
||||
KEY fk_maybe_target_entity_token (maybe_target_entity_token),
|
||||
KEY index_event_type (event_type)
|
||||
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
|
||||
Loading…
Reference in New Issue