From e6d1f0db11defea579f1aab8077d66a42aa54927 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Thu, 26 Jan 2023 00:29:45 -0500 Subject: [PATCH] Alter tts_models to add ratings counts --- .../down.sql | 7 +++++++ .../up.sql | 16 ++++++++++++++++ _migrations_squashed/tts_tables/tts_models.sql | 5 +++++ 3 files changed, 28 insertions(+) create mode 100644 _migrations/2023-01-26-050626_alter_tts_models_add_user_ratings/down.sql create mode 100644 _migrations/2023-01-26-050626_alter_tts_models_add_user_ratings/up.sql diff --git a/_migrations/2023-01-26-050626_alter_tts_models_add_user_ratings/down.sql b/_migrations/2023-01-26-050626_alter_tts_models_add_user_ratings/down.sql new file mode 100644 index 0000000000..176e9529d6 --- /dev/null +++ b/_migrations/2023-01-26-050626_alter_tts_models_add_user_ratings/down.sql @@ -0,0 +1,7 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +ALTER TABLE tts_models DROP COLUMN user_ratings_total_count; +ALTER TABLE tts_models DROP COLUMN user_ratings_positive_count; +ALTER TABLE tts_models DROP COLUMN user_ratings_negative_count; diff --git a/_migrations/2023-01-26-050626_alter_tts_models_add_user_ratings/up.sql b/_migrations/2023-01-26-050626_alter_tts_models_add_user_ratings/up.sql new file mode 100644 index 0000000000..744f35db9f --- /dev/null +++ b/_migrations/2023-01-26-050626_alter_tts_models_add_user_ratings/up.sql @@ -0,0 +1,16 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +-- Total count only includes "positive" and "negative" votes, not neutral ones. +ALTER TABLE tts_models + ADD COLUMN user_ratings_total_count INT(10) UNSIGNED NOT NULL DEFAULT 0 + AFTER private_bucket_object_is_archive; + +ALTER TABLE tts_models + ADD COLUMN user_ratings_positive_count INT(10) UNSIGNED NOT NULL DEFAULT 0 + AFTER user_ratings_total_count; + +ALTER TABLE tts_models + ADD COLUMN user_ratings_negative_count INT(10) UNSIGNED NOT NULL DEFAULT 0 + AFTER user_ratings_positive_count; diff --git a/_migrations_squashed/tts_tables/tts_models.sql b/_migrations_squashed/tts_tables/tts_models.sql index acaaa5f122..add0c2c4d9 100644 --- a/_migrations_squashed/tts_tables/tts_models.sql +++ b/_migrations_squashed/tts_tables/tts_models.sql @@ -162,6 +162,11 @@ CREATE TABLE tts_models ( -- calculated_total_ratings_submitted_count INT(10) NOT NULL DEFAULT 0, -- calculated_total_uses_count BIGINT(10) NOT NULL DEFAULT 0, + -- Total count only includes "positive" and "negative" votes, not neutral ones. + user_ratings_total_count INT(10) UNSIGNED NOT NULL DEFAULT 0, + user_ratings_positive_count INT(10) UNSIGNED NOT NULL DEFAULT 0, + user_ratings_negative_count INT(10) UNSIGNED NOT NULL DEFAULT 0, + -- ========== MODERATION DETAILS ========== -- Mods have to approve of tts models for them to show up in a public index.