diff --git a/migrations/2021-05-15-071601_assets/up.sql b/migrations/2021-05-15-071601_assets/up.sql index 6c2970602c..b052006ac3 100644 --- a/migrations/2021-05-15-071601_assets/up.sql +++ b/migrations/2021-05-15-071601_assets/up.sql @@ -94,7 +94,7 @@ CREATE TABLE w2l_templates ( id BIGINT(20) NOT NULL AUTO_INCREMENT, -- Effective "primary key" (PUBLIC) - token CHAR(16) NOT NULL UNIQUE, + token CHAR(16) NOT NULL, template_type ENUM( 'not-set', @@ -103,7 +103,7 @@ CREATE TABLE w2l_templates ( ) NOT NULL DEFAULT 'not-set', -- The title of the template. - title CHAR(255) NOT NULL UNIQUE, + title CHAR(255) NOT NULL, -- Users can upload their own private templates. -- They can choose to make them public later. diff --git a/migrations/2021-05-15-212913_inference_jobs/up.sql b/migrations/2021-05-15-212913_inference_jobs/up.sql index 539460164a..799b64e761 100644 --- a/migrations/2021-05-15-212913_inference_jobs/up.sql +++ b/migrations/2021-05-15-212913_inference_jobs/up.sql @@ -66,16 +66,16 @@ CREATE TABLE w2l_inference_jobs ( -- The W2L template to use -- Can be an image or video. -- This is null if we're using a custom uploaded image. - w2l_template_token CHAR(16) DEFAULT NULL, + maybe_w2l_template_token CHAR(16) DEFAULT NULL, -- If we're using TTS results, this will be present - tts_inference_result_token CHAR(16) DEFAULT NULL, + maybe_tts_inference_result_token CHAR(16) DEFAULT NULL, -- If we're using custom uploaded audio, this will be present. - audio_bucket_location CHAR(16) DEFAULT NULL, + maybe_audio_bucket_location CHAR(16) DEFAULT NULL, -- If we're using a custom uploaded image, this will be present. - image_bucket_location CHAR(16) DEFAULT NULL, + maybe_image_bucket_location CHAR(16) DEFAULT NULL, -- Jobs begin as "pending", then transition to other states. -- Pending -> Started -> Complete @@ -100,8 +100,8 @@ CREATE TABLE w2l_inference_jobs ( -- INDICES -- PRIMARY KEY (id), KEY fk_maybe_creator_user_token (maybe_creator_user_token), - KEY fk_w2l_template_token (w2l_template_token), - KEY fk_tts_inference_result_token (tts_inference_result_token), + KEY fk_maybe_w2l_template_token (maybe_w2l_template_token), + KEY fk_maybe_tts_inference_result_token (maybe_tts_inference_result_token), KEY index_status (status), KEY index_creator_ip_address (creator_ip_address) diff --git a/migrations/2021-05-15-212918_inference_results/down.sql b/migrations/2021-05-15-212918_inference_results/down.sql index e9ead36df2..261d58e669 100644 --- a/migrations/2021-05-15-212918_inference_results/down.sql +++ b/migrations/2021-05-15-212918_inference_results/down.sql @@ -1,2 +1,5 @@ # noinspection SqlResolveForFile # noinspection SqlNoDataSourceInspectionForFile + +drop table tts_results; +drop table w2l_results; diff --git a/migrations/2021-05-15-212918_inference_results/up.sql b/migrations/2021-05-15-212918_inference_results/up.sql index fc7d621a59..19270b58e8 100644 --- a/migrations/2021-05-15-212918_inference_results/up.sql +++ b/migrations/2021-05-15-212918_inference_results/up.sql @@ -1,2 +1,87 @@ # noinspection SqlResolveForFile -# noinspection SqlNoDataSourceInspectionForFile \ No newline at end of file +# noinspection SqlNoDataSourceInspectionForFile + +CREATE TABLE tts_results ( + -- Not used for anything except replication. + id BIGINT(20) NOT NULL AUTO_INCREMENT, + + -- Effective "primary key" (PUBLIC) + token CHAR(32) NOT NULL, + + -- The TTS model that was used + model_token CHAR(16) NOT NULL, + + -- The original raw, unprocessed user input. + inference_text TEXT NOT NULL, + + -- Users can upload their own private templates. + -- They can choose to make them public later. + is_private_for_creator BOOLEAN NOT NULL DEFAULT FALSE, + + -- The person that created the template. + -- If the user wasn't logged in, this is null + maybe_creator_user_token CHAR(16) DEFAULT NULL, + + -- For abuse tracking. + creator_ip_address CHAR(16) NOT NULL, + + -- Where the wav, spectrogram, and etc. are located. + public_bucket_hash CHAR(32) NOT NULL UNIQUE, + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + + -- If this is removed by a mod or the creator. + deleted_at TIMESTAMP NULL, + + -- INDICES -- + PRIMARY KEY (id), + UNIQUE KEY (token), + KEY fk_model_token (model_token), + KEY fk_maybe_creator_user_token (maybe_creator_user_token), + KEY index_creator_ip_address (creator_ip_address) + +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + +CREATE TABLE w2l_results ( + -- Not used for anything except replication. + id BIGINT(20) NOT NULL AUTO_INCREMENT, + + -- Effective "primary key" (PUBLIC) + token CHAR(32) NOT NULL, + + -- The w2l template that was used (if set) + maybe_w2l_template_token CHAR(16) NOT NULL, + + -- The inference result, if we're using them. + maybe_tts_inference_result_token CHAR(16) DEFAULT NULL, + + -- Users can upload their own private templates. + -- They can choose to make them public later. + is_private_for_creator BOOLEAN NOT NULL DEFAULT FALSE, + + -- The person that created the template. + -- If the user wasn't logged in, this is null + maybe_creator_user_token CHAR(16) DEFAULT NULL, + + -- For abuse tracking. + creator_ip_address CHAR(16) NOT NULL, + + -- Where the wav, spectrogram, and etc. are located. + public_bucket_hash CHAR(32) NOT NULL UNIQUE, + + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + + -- If this is removed by a mod or the creator. + deleted_at TIMESTAMP NULL, + + -- INDICES -- + PRIMARY KEY (id), + UNIQUE KEY (token), + KEY fk_maybe_creator_user_token (maybe_creator_user_token), + KEY fk_maybe_w2l_template_token (maybe_w2l_template_token), + KEY fk_maybe_tts_inference_result_token (maybe_tts_inference_result_token), + KEY index_creator_ip_address (creator_ip_address) + +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;