From 26bbbc412b53d659f80856533d985402bf730146 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 1 Mar 2022 04:06:33 -0500 Subject: [PATCH] migrations for new columns: langauge, tts command --- .../down.sql | 9 +++++++++ .../up.sql | 13 +++++++++++++ .../down.sql | 6 ++++++ .../up.sql | 14 ++++++++++++++ _migrations_squashed/tts_tables/tts_models.sql | 11 +++++++++++ 5 files changed, 53 insertions(+) create mode 100644 _migrations/2022-03-01-085243_alter_table_tts_models_add_language/down.sql create mode 100644 _migrations/2022-03-01-085243_alter_table_tts_models_add_language/up.sql create mode 100644 _migrations/2022-03-01-085254_alter_table_tts_models_add_bot_command/down.sql create mode 100644 _migrations/2022-03-01-085254_alter_table_tts_models_add_bot_command/up.sql diff --git a/_migrations/2022-03-01-085243_alter_table_tts_models_add_language/down.sql b/_migrations/2022-03-01-085243_alter_table_tts_models_add_language/down.sql new file mode 100644 index 0000000000..7c3a1d738d --- /dev/null +++ b/_migrations/2022-03-01-085243_alter_table_tts_models_add_language/down.sql @@ -0,0 +1,9 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +ALTER TABLE tts_models + DROP COLUMN ietf_language_tag; + +ALTER TABLE tts_models + DROP COLUMN ietf_primary_language_subtag; diff --git a/_migrations/2022-03-01-085243_alter_table_tts_models_add_language/up.sql b/_migrations/2022-03-01-085243_alter_table_tts_models_add_language/up.sql new file mode 100644 index 0000000000..7665828672 --- /dev/null +++ b/_migrations/2022-03-01-085243_alter_table_tts_models_add_language/up.sql @@ -0,0 +1,13 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +-- The IETF BCP47 language tag (eg. en-US, es-419, ja-JP, etc.) +ALTER TABLE tts_models + ADD COLUMN ietf_language_tag VARCHAR(64) NOT NULL DEFAULT 'en-US' + AFTER maybe_default_pretrained_vocoder; + +-- The IETF BCP47 language tag's primary language subtag (eg. "es-419" becomes "es") +ALTER TABLE tts_models + ADD COLUMN ietf_primary_language_subtag VARCHAR(12) NOT NULL DEFAULT 'en' + AFTER ietf_language_tag; diff --git a/_migrations/2022-03-01-085254_alter_table_tts_models_add_bot_command/down.sql b/_migrations/2022-03-01-085254_alter_table_tts_models_add_bot_command/down.sql new file mode 100644 index 0000000000..30f0bd8a8e --- /dev/null +++ b/_migrations/2022-03-01-085254_alter_table_tts_models_add_bot_command/down.sql @@ -0,0 +1,6 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +ALTER TABLE tts_models + DROP COLUMN maybe_unique_bot_command_prefix; diff --git a/_migrations/2022-03-01-085254_alter_table_tts_models_add_bot_command/up.sql b/_migrations/2022-03-01-085254_alter_table_tts_models_add_bot_command/up.sql new file mode 100644 index 0000000000..ad3a9af70b --- /dev/null +++ b/_migrations/2022-03-01-085254_alter_table_tts_models_add_bot_command/up.sql @@ -0,0 +1,14 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +-- A bot command prefix, eg. 'sonic' that could be interpreted as '/sonic' by a TTS system. +-- These are unique strings and can only be applied to one model at a time. +-- Only moderators can set this, and it's only for the best voices. +ALTER TABLE tts_models + ADD COLUMN maybe_unique_bot_command_prefix VARCHAR(255) DEFAULT NULL + AFTER is_twitch_featured; + +-- And the unique index. +ALTER TABLE tts_models + ADD UNIQUE INDEX unique_index_maybe_unique_bot_command_prefix (maybe_unique_bot_command_prefix); diff --git a/_migrations_squashed/tts_tables/tts_models.sql b/_migrations_squashed/tts_tables/tts_models.sql index 71c6924e91..e89f68defb 100644 --- a/_migrations_squashed/tts_tables/tts_models.sql +++ b/_migrations_squashed/tts_tables/tts_models.sql @@ -61,6 +61,12 @@ CREATE TABLE tts_models ( -- ========== UNSTRUCTURED METADATA ========== + -- The IETF BCP47 language tag (eg. en-US, es-419, ja-JP, etc.) + ietf_language_tag VARCHAR(64) NOT NULL DEFAULT 'en-US', + + -- The IETF BCP47 language tag's primary language subtag (eg. "es-419" becomes "es") + ietf_primary_language_subtag VARCHAR(12) NOT NULL DEFAULT 'en', + -- The "name" of the voice model, which might be complicated. -- If maybe_subject_token (etc.) is set, then it's authoritative instead. title VARCHAR(255) NOT NULL, @@ -87,6 +93,11 @@ CREATE TABLE tts_models ( is_front_page_featured BOOLEAN NOT NULL DEFAULT FALSE, is_twitch_featured BOOLEAN NOT NULL DEFAULT FALSE, + -- A bot command prefix, eg. 'sonic' that could be interpreted as '/sonic' by a TTS system. + -- These are unique strings and can only be applied to one model at a time. + -- Only moderators can set this, and it's only for the best voices. + maybe_unique_bot_command_prefix VARCHAR(255) DEFAULT NULL, + -- ========== IMMUTABLE PROVENANCE AND METADATA ========== -- Where the file was originally downloaded (if it was downloaded)