diff --git a/.sqlx/query-0a392b6adb884a4bb4c08fbc2123d40c27e9fbb5c2b688b182f849b0c1cc5735.json b/.sqlx/query-0a392b6adb884a4bb4c08fbc2123d40c27e9fbb5c2b688b182f849b0c1cc5735.json new file mode 100644 index 0000000000..a906df9496 --- /dev/null +++ b/.sqlx/query-0a392b6adb884a4bb4c08fbc2123d40c27e9fbb5c2b688b182f849b0c1cc5735.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_cover_image_media_file_token = NULL,\n maybe_description_markdown = ?,\n maybe_description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n\nON DUPLICATE KEY UPDATE\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_cover_image_media_file_token = NULL,\n maybe_description_markdown = ?,\n maybe_description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 43 + }, + "nullable": [] + }, + "hash": "0a392b6adb884a4bb4c08fbc2123d40c27e9fbb5c2b688b182f849b0c1cc5735" +} diff --git a/.sqlx/query-0e95df24f6301525e59cc281cca9cc8e95f6b58e8abbd0b4404ab0b1a699e71c.json b/.sqlx/query-0e95df24f6301525e59cc281cca9cc8e95f6b58e8abbd0b4404ab0b1a699e71c.json new file mode 100644 index 0000000000..57125f031a --- /dev/null +++ b/.sqlx/query-0e95df24f6301525e59cc281cca9cc8e95f6b58e8abbd0b4404ab0b1a699e71c.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "\n UPDATE model_weights\n SET\n title = COALESCE(?, title),\n maybe_description_markdown = COALESCE(?, maybe_description_markdown),\n maybe_description_rendered_html = COALESCE(?, maybe_description_rendered_html),\n creator_set_visibility = COALESCE(?, creator_set_visibility),\n version = version + 1\n WHERE token = ?\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 5 + }, + "nullable": [] + }, + "hash": "0e95df24f6301525e59cc281cca9cc8e95f6b58e8abbd0b4404ab0b1a699e71c" +} diff --git a/.sqlx/query-4aeff65c652a5db1a09d65af1c828c2a018eeb979ede924264c6d90a698bfac4.json b/.sqlx/query-4aeff65c652a5db1a09d65af1c828c2a018eeb979ede924264c6d90a698bfac4.json deleted file mode 100644 index e07c3bdd4c..0000000000 --- a/.sqlx/query-4aeff65c652a5db1a09d65af1c828c2a018eeb979ede924264c6d90a698bfac4.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "MySQL", - "query": "\n UPDATE model_weights\n SET\n title = COALESCE(?, title),\n description_markdown = COALESCE(?, description_markdown),\n description_rendered_html = COALESCE(?, description_rendered_html),\n creator_set_visibility = COALESCE(?, creator_set_visibility),\n version = version + 1\n WHERE token = ?\n ", - "describe": { - "columns": [], - "parameters": { - "Right": 5 - }, - "nullable": [] - }, - "hash": "4aeff65c652a5db1a09d65af1c828c2a018eeb979ede924264c6d90a698bfac4" -} diff --git a/.sqlx/query-5498a76dbb2b6a6c3a94e4c143b7863d4b2ac4b63820658f02e538f7d4213cc7.json b/.sqlx/query-5498a76dbb2b6a6c3a94e4c143b7863d4b2ac4b63820658f02e538f7d4213cc7.json deleted file mode 100644 index 2930ae0b1e..0000000000 --- a/.sqlx/query-5498a76dbb2b6a6c3a94e4c143b7863d4b2ac4b63820658f02e538f7d4213cc7.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "MySQL", - "query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n\n maybe_cover_image_media_file_token = NULL,\n description_markdown = \"\",\n description_rendered_html = \"\",\n\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?\n ", - "describe": { - "columns": [], - "parameters": { - "Right": 15 - }, - "nullable": [] - }, - "hash": "5498a76dbb2b6a6c3a94e4c143b7863d4b2ac4b63820658f02e538f7d4213cc7" -} diff --git a/.sqlx/query-6512f05410514927b52b8cc42f4eda0ad7a256254fd7fcf3b8a1cc429b06ad38.json b/.sqlx/query-6512f05410514927b52b8cc42f4eda0ad7a256254fd7fcf3b8a1cc429b06ad38.json new file mode 100644 index 0000000000..4fe8bf567c --- /dev/null +++ b/.sqlx/query-6512f05410514927b52b8cc42f4eda0ad7a256254fd7fcf3b8a1cc429b06ad38.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n\n maybe_cover_image_media_file_token = NULL,\n maybe_description_markdown = NULL,\n maybe_description_rendered_html = NULL,\n\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 15 + }, + "nullable": [] + }, + "hash": "6512f05410514927b52b8cc42f4eda0ad7a256254fd7fcf3b8a1cc429b06ad38" +} diff --git a/.sqlx/query-c26943bde6d2364f0f1594dfbf4fa40c8f94706f1cc413aea6bf213df5d533d5.json b/.sqlx/query-7d3806f46b5cc96c0e3df22454190834c0294ad34db2d8271f2e2863a3cca3a1.json similarity index 81% rename from .sqlx/query-c26943bde6d2364f0f1594dfbf4fa40c8f94706f1cc413aea6bf213df5d533d5.json rename to .sqlx/query-7d3806f46b5cc96c0e3df22454190834c0294ad34db2d8271f2e2863a3cca3a1.json index 0ba859953a..b64d867a14 100644 --- a/.sqlx/query-c26943bde6d2364f0f1594dfbf4fa40c8f94706f1cc413aea6bf213df5d533d5.json +++ b/.sqlx/query-7d3806f46b5cc96c0e3df22454190834c0294ad34db2d8271f2e2863a3cca3a1.json @@ -1,6 +1,6 @@ { "db_name": "MySQL", - "query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.description_markdown,\n wt.description_rendered_html,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n WHERE\n wt.token = ?\n ", + "query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n WHERE\n wt.token = ?\n ", "describe": { "columns": [ { @@ -45,20 +45,20 @@ }, { "ordinal": 4, - "name": "description_markdown", + "name": "maybe_description_markdown", "type_info": { "type": "Blob", - "flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE", + "flags": "BLOB | BINARY", "char_set": 224, "max_size": 262140 } }, { "ordinal": 5, - "name": "description_rendered_html", + "name": "maybe_description_rendered_html", "type_info": { "type": "Blob", - "flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE", + "flags": "BLOB | BINARY", "char_set": 224, "max_size": 262140 } @@ -342,8 +342,8 @@ false, false, false, - false, - false, + true, + true, false, false, false, @@ -373,5 +373,5 @@ true ] }, - "hash": "c26943bde6d2364f0f1594dfbf4fa40c8f94706f1cc413aea6bf213df5d533d5" + "hash": "7d3806f46b5cc96c0e3df22454190834c0294ad34db2d8271f2e2863a3cca3a1" } diff --git a/.sqlx/query-839a90609725c9dd5d916e111c97d50fd2f6f4084024b4b706df3e8cf91753c6.json b/.sqlx/query-839a90609725c9dd5d916e111c97d50fd2f6f4084024b4b706df3e8cf91753c6.json deleted file mode 100644 index 5f678a64c6..0000000000 --- a/.sqlx/query-839a90609725c9dd5d916e111c97d50fd2f6f4084024b4b706df3e8cf91753c6.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "MySQL", - "query": "\n INSERT INTO model_weights\n SET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n description_markdown = ?,\n description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = ?,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = ?,\n cached_user_ratings_positive_count = ?,\n cached_user_ratings_negative_count = ?,\n maybe_cached_user_ratings_ratio = ?,\n version = ?\n ", - "describe": { - "columns": [], - "parameters": { - "Right": 22 - }, - "nullable": [] - }, - "hash": "839a90609725c9dd5d916e111c97d50fd2f6f4084024b4b706df3e8cf91753c6" -} diff --git a/.sqlx/query-a18c5b1418d71fa9aefd3ae5c440be2afc1f9467808aa66d3b850a4d54c81e4d.json b/.sqlx/query-a18c5b1418d71fa9aefd3ae5c440be2afc1f9467808aa66d3b850a4d54c81e4d.json new file mode 100644 index 0000000000..a91c703081 --- /dev/null +++ b/.sqlx/query-a18c5b1418d71fa9aefd3ae5c440be2afc1f9467808aa66d3b850a4d54c81e4d.json @@ -0,0 +1,12 @@ +{ + "db_name": "MySQL", + "query": "\n INSERT INTO model_weights\n SET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_description_markdown = ?,\n maybe_description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = ?,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = ?,\n cached_user_ratings_positive_count = ?,\n cached_user_ratings_negative_count = ?,\n maybe_cached_user_ratings_ratio = ?,\n version = ?\n ", + "describe": { + "columns": [], + "parameters": { + "Right": 22 + }, + "nullable": [] + }, + "hash": "a18c5b1418d71fa9aefd3ae5c440be2afc1f9467808aa66d3b850a4d54c81e4d" +} diff --git a/.sqlx/query-b15b16149e6a765de1949cc77dd8b38188295df583de5214baa5e2d66782ef59.json b/.sqlx/query-bb2c5a81ab6f38ecef7ee177a4ea36e75c5d2180a897094f940f097bbbd66060.json similarity index 80% rename from .sqlx/query-b15b16149e6a765de1949cc77dd8b38188295df583de5214baa5e2d66782ef59.json rename to .sqlx/query-bb2c5a81ab6f38ecef7ee177a4ea36e75c5d2180a897094f940f097bbbd66060.json index a90459a11e..6b37cdbb7e 100644 --- a/.sqlx/query-b15b16149e6a765de1949cc77dd8b38188295df583de5214baa5e2d66782ef59.json +++ b/.sqlx/query-bb2c5a81ab6f38ecef7ee177a4ea36e75c5d2180a897094f940f097bbbd66060.json @@ -1,6 +1,6 @@ { "db_name": "MySQL", - "query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.description_markdown,\n wt.description_rendered_html,\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n WHERE\n wt.token = ?\n AND wt.user_deleted_at IS NULL\n AND wt.mod_deleted_at IS NULL\n ", + "query": "\n SELECT\n wt.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n wt.title,\n wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n wt.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n wt.creator_ip_address,\n wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`,\n users.username as creator_username,\n users.display_name as creator_display_name,\n users.email_gravatar_hash AS creator_gravatar_hash,\n\n wt.maybe_last_update_user_token as `maybe_last_update_user_token: tokens::tokens::users::UserToken`,\n wt.original_download_url,\n wt.original_filename,\n wt.file_size_bytes,\n wt.file_checksum_sha2,\n wt.public_bucket_hash,\n wt.maybe_public_bucket_prefix,\n wt.maybe_public_bucket_extension,\n\n cover_image.public_bucket_directory_hash as maybe_cover_image_public_bucket_hash,\n cover_image.maybe_public_bucket_prefix as maybe_cover_image_public_bucket_prefix,\n cover_image.maybe_public_bucket_extension as maybe_cover_image_public_bucket_extension,\n\n wt.cached_user_ratings_negative_count,\n wt.cached_user_ratings_positive_count,\n wt.cached_user_ratings_total_count,\n wt.maybe_cached_user_ratings_ratio,\n wt.cached_user_ratings_last_updated_at,\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n FROM model_weights as wt\n JOIN users\n ON users.token = wt.creator_user_token\n LEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = wt.maybe_cover_image_media_file_token\n WHERE\n wt.token = ?\n AND wt.user_deleted_at IS NULL\n AND wt.mod_deleted_at IS NULL\n ", "describe": { "columns": [ { @@ -45,20 +45,20 @@ }, { "ordinal": 4, - "name": "description_markdown", + "name": "maybe_description_markdown", "type_info": { "type": "Blob", - "flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE", + "flags": "BLOB | BINARY", "char_set": 224, "max_size": 262140 } }, { "ordinal": 5, - "name": "description_rendered_html", + "name": "maybe_description_rendered_html", "type_info": { "type": "Blob", - "flags": "NOT_NULL | BLOB | BINARY | NO_DEFAULT_VALUE", + "flags": "BLOB | BINARY", "char_set": 224, "max_size": 262140 } @@ -342,8 +342,8 @@ false, false, false, - false, - false, + true, + true, false, false, false, @@ -373,5 +373,5 @@ true ] }, - "hash": "b15b16149e6a765de1949cc77dd8b38188295df583de5214baa5e2d66782ef59" + "hash": "bb2c5a81ab6f38ecef7ee177a4ea36e75c5d2180a897094f940f097bbbd66060" } diff --git a/.sqlx/query-ec1a3b0dfea8dfded94efac1b90fe3ebd0345e5b49fddbbe126cca7569698629.json b/.sqlx/query-ec1a3b0dfea8dfded94efac1b90fe3ebd0345e5b49fddbbe126cca7569698629.json deleted file mode 100644 index 23d76786da..0000000000 --- a/.sqlx/query-ec1a3b0dfea8dfded94efac1b90fe3ebd0345e5b49fddbbe126cca7569698629.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "db_name": "MySQL", - "query": "\nINSERT INTO model_weights\nSET\n token = ?,\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_cover_image_media_file_token = NULL,\n description_markdown = ?,\n description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n\nON DUPLICATE KEY UPDATE\n weights_type = ?,\n weights_category = ?,\n title = ?,\n maybe_cover_image_media_file_token = NULL,\n description_markdown = ?,\n description_rendered_html = ?,\n creator_user_token = ?,\n creator_ip_address = ?,\n creator_set_visibility = ?,\n maybe_last_update_user_token = NULL,\n original_download_url = ?,\n original_filename = ?,\n file_size_bytes = ?,\n file_checksum_sha2 = ?,\n public_bucket_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n cached_user_ratings_total_count = 0,\n cached_user_ratings_positive_count = 0,\n cached_user_ratings_negative_count = 0,\n maybe_cached_user_ratings_ratio = 0.0,\n cached_user_ratings_last_updated_at = NOW(),\n maybe_migration_old_model_token = ?,\n version = ?,\n created_at = ?,\n updated_at = ?,\n user_deleted_at = ?,\n mod_deleted_at = ?\n ", - "describe": { - "columns": [], - "parameters": { - "Right": 43 - }, - "nullable": [] - }, - "hash": "ec1a3b0dfea8dfded94efac1b90fe3ebd0345e5b49fddbbe126cca7569698629" -} diff --git a/_sql/migrations/2023-12-24-064234_alter_model_weights_nullable_description/down.sql b/_sql/migrations/2023-12-24-064234_alter_model_weights_nullable_description/down.sql new file mode 100644 index 0000000000..b075b2b915 --- /dev/null +++ b/_sql/migrations/2023-12-24-064234_alter_model_weights_nullable_description/down.sql @@ -0,0 +1,9 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +ALTER TABLE model_weights + CHANGE maybe_description_markdown description_markdown TEXT NOT NULL; + +ALTER TABLE model_weights + CHANGE maybe_description_rendered_html description_rendered_html TEXT NOT NULL; diff --git a/_sql/migrations/2023-12-24-064234_alter_model_weights_nullable_description/up.sql b/_sql/migrations/2023-12-24-064234_alter_model_weights_nullable_description/up.sql new file mode 100644 index 0000000000..18c5bdd84b --- /dev/null +++ b/_sql/migrations/2023-12-24-064234_alter_model_weights_nullable_description/up.sql @@ -0,0 +1,9 @@ +-- noinspection SqlDialectInspectionForFile +-- noinspection SqlNoDataSourceInspectionForFile +-- noinspection SqlResolveForFile + +ALTER TABLE model_weights + CHANGE description_markdown maybe_description_markdown TEXT DEFAULT NULL; + +ALTER TABLE model_weights + CHANGE description_rendered_html maybe_description_rendered_html TEXT DEFAULT NULL; diff --git a/_sql/migrations_squashed/model_weights/model_weights.sql b/_sql/migrations_squashed/model_weights/model_weights.sql index 7097d958a2..9f891dc066 100644 --- a/_sql/migrations_squashed/model_weights/model_weights.sql +++ b/_sql/migrations_squashed/model_weights/model_weights.sql @@ -44,10 +44,14 @@ CREATE TABLE model_weights ( maybe_cover_image_media_file_token VARCHAR(32) DEFAULT NULL, -- The description of the model in markdown. - description_markdown TEXT NOT NULL, + -- This is optional, since not all weights are of the same caliber (eg. zero shot models + -- don't deserve a description). + maybe_description_markdown TEXT DEFAULT NULL, -- Generated HTML (not user-editable). - description_rendered_html TEXT NOT NULL, + -- This is optional, since not all weights are of the same caliber (eg. zero shot + -- models don't deserve a description). + maybe_description_rendered_html TEXT DEFAULT NULL, -- ========== CREATOR DETAILS ========== diff --git a/crates/cli/dev-database-seed/src/seeding/model_weights.rs b/crates/cli/dev-database-seed/src/seeding/model_weights.rs index 19c1fbd5b3..3f3e704136 100644 --- a/crates/cli/dev-database-seed/src/seeding/model_weights.rs +++ b/crates/cli/dev-database-seed/src/seeding/model_weights.rs @@ -305,8 +305,8 @@ pub async fn seed_weights_for_paging(mysql_pool: &Pool, user_token: UserT weights_type: weights_types, // replace with actual WeightsType weights_category, // replace with actual WeightsCategory title, - description_markdown: description, - description_rendered_html: description_rendered_html.to_string(), + maybe_description_markdown: Some(description), + maybe_description_rendered_html: Some(description_rendered_html.to_string()), creator_user_token: Some(&user_token), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, @@ -350,8 +350,8 @@ pub async fn seed_weights_for_user_token( weights_type: WeightsType::RvcV2, // replace with actual WeightsType weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory title: "Title 1".to_string(), - description_markdown: "Description 1".to_string(), - description_rendered_html: "

Description 1

".to_string(), + maybe_description_markdown: Some("Description 1".to_string()), + maybe_description_rendered_html: Some("

Description 1

".to_string()), creator_user_token: Some(&user_token), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, @@ -375,8 +375,8 @@ pub async fn seed_weights_for_user_token( weights_type: WeightsType::HifiganTacotron2, // replace with actual WeightsType weights_category: WeightsCategory::TextToSpeech, // replace with actual WeightsCategory title: "Title 2".to_string(), - description_markdown: "Description 2".to_string(), - description_rendered_html: "

Description 2

".to_string(), + maybe_description_markdown: Some("Description 2".to_string()), + maybe_description_rendered_html: Some("

Description 2

".to_string()), creator_user_token: Some(&user_token), // replace with actual UserToken creator_ip_address: "292.268.2.2", creator_set_visibility: Visibility::Public, @@ -400,8 +400,8 @@ pub async fn seed_weights_for_user_token( weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory title: "Title 3".to_string(), - description_markdown: "Description 3".to_string(), - description_rendered_html: "

Description 3

".to_string(), + maybe_description_markdown: Some("Description 3".to_string()), + maybe_description_rendered_html: Some("

Description 3

".to_string()), creator_user_token: Some(&user_token), // replace with actual UserToken creator_ip_address: "392.368.3.3", creator_set_visibility: Visibility::Public, @@ -425,8 +425,8 @@ pub async fn seed_weights_for_user_token( weights_type: WeightsType::LoRA, // replace with actual WeightsType weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory title: "Title 4".to_string(), - description_markdown: "Description 4".to_string(), - description_rendered_html: "

Description 4

".to_string(), + maybe_description_markdown: Some("Description 4".to_string()), + maybe_description_rendered_html: Some("

Description 4

".to_string()), creator_user_token: Some(&user_token), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, @@ -450,8 +450,8 @@ pub async fn seed_weights_for_user_token( weights_type: WeightsType::LoRA, // replace with actual WeightsType weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory title: "Title 5".to_string(), - description_markdown: "Description 4".to_string(), - description_rendered_html: "

Description 4

".to_string(), + maybe_description_markdown: Some("Description 4".to_string()), + maybe_description_rendered_html: Some("

Description 4

".to_string()), creator_user_token: Some(&user_token), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, @@ -501,8 +501,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool,user_token: UserToke weights_type: WeightsType::RvcV2, // replace with actual WeightsType weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory title: "Title 1".to_string(), - description_markdown: "Description 1".to_string(), - description_rendered_html: "

Description 1

".to_string(), + maybe_description_markdown: Some("Description 1".to_string()), + maybe_description_rendered_html: Some("

Description 1

".to_string()), creator_user_token: Some(&creator_token1), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, @@ -526,8 +526,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool,user_token: UserToke weights_type: WeightsType::HifiganTacotron2, // replace with actual WeightsType weights_category: WeightsCategory::TextToSpeech, // replace with actual WeightsCategory title: "Title 2".to_string(), - description_markdown: "Description 2".to_string(), - description_rendered_html: "

Description 2

".to_string(), + maybe_description_markdown: Some("Description 2".to_string()), + maybe_description_rendered_html: Some("

Description 2

".to_string()), creator_user_token: Some(&creator_token2), // replace with actual UserToken creator_ip_address: "292.268.2.2", creator_set_visibility: Visibility::Public, @@ -551,8 +551,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool,user_token: UserToke weights_type: WeightsType::StableDiffusion15, // replace with actual WeightsType weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory title: "Title 3".to_string(), - description_markdown: "Description 3".to_string(), - description_rendered_html: "

Description 3

".to_string(), + maybe_description_markdown: Some("Description 3".to_string()), + maybe_description_rendered_html: Some("

Description 3

".to_string()), creator_user_token: Some(&creator_token3), // replace with actual UserToken creator_ip_address: "392.368.3.3", creator_set_visibility: Visibility::Public, @@ -576,8 +576,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool,user_token: UserToke weights_type: WeightsType::LoRA, // replace with actual WeightsType weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory title: "Title 4".to_string(), - description_markdown: "Description 4".to_string(), - description_rendered_html: "

Description 4

".to_string(), + maybe_description_markdown: Some("Description 4".to_string()), + maybe_description_rendered_html: Some("

Description 4

".to_string()), creator_user_token: Some(&creator_token4), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, @@ -601,8 +601,8 @@ pub async fn original_seed_weights(mysql_pool: &Pool,user_token: UserToke weights_type: WeightsType::LoRA, // replace with actual WeightsType weights_category: WeightsCategory::ImageGeneration, // replace with actual WeightsCategory title: "Title 5".to_string(), - description_markdown: "Description 5".to_string(), - description_rendered_html: "

Description 5

".to_string(), + maybe_description_markdown: Some("Description 5".to_string()), + maybe_description_rendered_html: Some("

Description 5

".to_string()), creator_user_token: Some(&creator_token5), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, diff --git a/crates/cli/dev-database-seed/src/seeding/seed_model_weights.rs b/crates/cli/dev-database-seed/src/seeding/seed_model_weights.rs index c8fcc47f95..0660b063c1 100644 --- a/crates/cli/dev-database-seed/src/seeding/seed_model_weights.rs +++ b/crates/cli/dev-database-seed/src/seeding/seed_model_weights.rs @@ -129,8 +129,8 @@ pub async fn seed_weights_files( weights_type, // Assuming weights_type is defined elsewhere weights_category, // Assuming weights_category is defined elsewhere title: title.to_string(), - description_markdown: description.to_string(), - description_rendered_html: description_rendered_html.to_string(), + maybe_description_markdown: Some(description.to_string()), + maybe_description_rendered_html: Some(description_rendered_html.to_string()), creator_user_token: Some(&user_token), creator_ip_address: "127.0.0.1", // Assuming the IP address is localhost creator_set_visibility: Visibility::Public, // Assuming the visibility is public diff --git a/crates/lib/mysql_queries/src/queries/model_weights/create/create_model_weight_from_voice_conversion_download_job.rs b/crates/lib/mysql_queries/src/queries/model_weights/create/create_model_weight_from_voice_conversion_download_job.rs index 82edcdfbbe..ee2063c018 100644 --- a/crates/lib/mysql_queries/src/queries/model_weights/create/create_model_weight_from_voice_conversion_download_job.rs +++ b/crates/lib/mysql_queries/src/queries/model_weights/create/create_model_weight_from_voice_conversion_download_job.rs @@ -64,8 +64,8 @@ SET title = ?, maybe_cover_image_media_file_token = NULL, - description_markdown = "", - description_rendered_html = "", + maybe_description_markdown = NULL, + maybe_description_rendered_html = NULL, maybe_last_update_user_token = NULL, original_download_url = ?, diff --git a/crates/lib/mysql_queries/src/queries/model_weights/create/create_weight.rs b/crates/lib/mysql_queries/src/queries/model_weights/create/create_weight.rs index 31592a6ad9..a6ab33c456 100644 --- a/crates/lib/mysql_queries/src/queries/model_weights/create/create_weight.rs +++ b/crates/lib/mysql_queries/src/queries/model_weights/create/create_weight.rs @@ -13,8 +13,8 @@ pub struct CreateModelWeightsArgs<'a> { pub weights_type: WeightsType, pub weights_category: WeightsCategory, pub title: String, - pub description_markdown: String, - pub description_rendered_html: String, + pub maybe_description_markdown: Option, + pub maybe_description_rendered_html: Option, pub creator_user_token: Option<&'a UserToken>, pub creator_ip_address: &'a str, pub creator_set_visibility: Visibility, @@ -46,8 +46,8 @@ pub async fn create_weight(args: CreateModelWeightsArgs<'_>) -> AnyhowResult) -> AnyhowResult { pub weight_token: &'a ModelWeightToken, pub title: Option<&'a str>, - pub description_markdown: Option<&'a str>, - pub description_rendered_html: Option<&'a str>, + pub maybe_description_markdown: Option<&'a str>, + pub maybe_description_rendered_html: Option<&'a str>, pub creator_set_visibility: Option<&'a Visibility>, pub weights_type: Option, pub weights_category: Option, @@ -25,15 +25,15 @@ pub async fn update_weights(args: UpdateWeightArgs<'_>) -> AnyhowResult<()> { UPDATE model_weights SET title = COALESCE(?, title), - description_markdown = COALESCE(?, description_markdown), - description_rendered_html = COALESCE(?, description_rendered_html), + maybe_description_markdown = COALESCE(?, maybe_description_markdown), + maybe_description_rendered_html = COALESCE(?, maybe_description_rendered_html), creator_set_visibility = COALESCE(?, creator_set_visibility), version = version + 1 WHERE token = ? "#, args.title.as_deref(), - args.description_markdown.as_deref(), - args.description_rendered_html.as_deref(), + args.maybe_description_markdown.as_deref(), + args.maybe_description_rendered_html.as_deref(), args.creator_set_visibility.as_deref(), args.weight_token.as_str() ) @@ -59,6 +59,7 @@ mod tests { use config::shared_constants::DEFAULT_MYSQL_CONNECTION_STRING; use errors::AnyhowResult; + #[ignore] #[tokio::test] async fn test_update_weights() -> AnyhowResult<()> { let db_connection_string = DEFAULT_MYSQL_CONNECTION_STRING; diff --git a/crates/lib/mysql_queries/src/queries/model_weights/get_weight.rs b/crates/lib/mysql_queries/src/queries/model_weights/get_weight.rs index 21c917f186..88145cd7b7 100644 --- a/crates/lib/mysql_queries/src/queries/model_weights/get_weight.rs +++ b/crates/lib/mysql_queries/src/queries/model_weights/get_weight.rs @@ -19,8 +19,8 @@ pub struct RetrievedModelWeight { pub title: String, pub weights_type: WeightsType, pub weights_category: WeightsCategory, - pub description_markdown: String, - pub description_rendered_html: String, + pub maybe_description_markdown: Option, + pub maybe_description_rendered_html: Option, pub creator_user_token: UserToken, pub creator_username: String, @@ -94,8 +94,8 @@ pub async fn get_weights_by_token_with_connection( title: record.title, weights_type: record.weights_type, weights_category: record.weights_category, - description_markdown: record.description_markdown, - description_rendered_html: record.description_rendered_html, + maybe_description_markdown: record.maybe_description_markdown, + maybe_description_rendered_html: record.maybe_description_rendered_html, creator_user_token: record.creator_user_token, creator_username: record.creator_username, creator_display_name: record.creator_display_name, @@ -140,8 +140,8 @@ async fn select_include_deleted( wt.title, wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`, wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`, - wt.description_markdown, - wt.description_rendered_html, + wt.maybe_description_markdown, + wt.maybe_description_rendered_html, wt.creator_user_token as `creator_user_token: tokens::tokens::users::UserToken`, users.username as creator_username, @@ -202,8 +202,8 @@ async fn select_without_deleted( wt.title, wt.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`, wt.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`, - wt.description_markdown, - wt.description_rendered_html, + wt.maybe_description_markdown, + wt.maybe_description_rendered_html, wt.creator_ip_address, wt.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`, @@ -257,8 +257,8 @@ pub struct RawWeight { pub title: String, pub weights_type: WeightsType, pub weights_category: WeightsCategory, - pub description_markdown: String, - pub description_rendered_html: String, + pub maybe_description_markdown: Option, + pub maybe_description_rendered_html: Option, pub creator_user_token: UserToken, pub creator_username: String, diff --git a/crates/lib/mysql_queries/src/queries/model_weights/list/list_weights_by_user.rs b/crates/lib/mysql_queries/src/queries/model_weights/list/list_weights_by_user.rs index 755c556e28..0b41b7dc16 100644 --- a/crates/lib/mysql_queries/src/queries/model_weights/list/list_weights_by_user.rs +++ b/crates/lib/mysql_queries/src/queries/model_weights/list/list_weights_by_user.rs @@ -30,9 +30,11 @@ pub struct WeightsJoinUserRecord { pub weights_category: WeightsCategory, pub title: String, - - pub description_markdown: String, - pub description_rendered_html: String, + + // TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint. + // Hopefully we don't break the frontend by omitting these. + //pub maybe_description_markdown: String, + //pub maybe_description_rendered_html: String, pub creator_user_token: UserToken, pub creator_ip_address: String, @@ -140,8 +142,6 @@ fn select_result_fields() -> String { mw.title, mw.weights_type, mw.weights_category, - mw.description_markdown, - mw.description_rendered_html, u.token as creator_user_token, u.username as creator_username, u.display_name as creator_display_name, @@ -230,8 +230,8 @@ async fn map_to_weights(dataset:Vec) -> Vec) -> Vec for RawWeightJoinUser { weights_type: row.try_get("weights_type")?, weights_category: row.try_get("weights_category")?, title: row.try_get("title")?, - description_markdown: row.try_get("description_markdown")?, - description_rendered_html: row.try_get("description_rendered_html")?, + // TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint. + // Hopefully we don't break the frontend by omitting these. + //maybe_description_markdown: row.try_get("maybe_description_markdown")?, + //maybe_description_rendered_html: row.try_get("maybe_description_rendered_html")?, creator_user_token: row.try_get("creator_user_token")?, creator_ip_address: row.try_get("creator_ip_address")?, creator_set_visibility: Visibility::try_from_mysql_row(row, "creator_set_visibility")?, diff --git a/crates/lib/mysql_queries/src/queries/model_weights/list/list_weights_query_builder.rs b/crates/lib/mysql_queries/src/queries/model_weights/list/list_weights_query_builder.rs index f44231b802..115af2c33e 100644 --- a/crates/lib/mysql_queries/src/queries/model_weights/list/list_weights_query_builder.rs +++ b/crates/lib/mysql_queries/src/queries/model_weights/list/list_weights_query_builder.rs @@ -36,8 +36,8 @@ pub struct WeightJoinUser { pub title: String, - pub description_markdown: String, - pub description_rendered_html: String, + pub maybe_description_markdown: Option, + pub maybe_description_rendered_html: Option, pub creator_user_token: UserToken, pub creator_ip_address: String, @@ -218,8 +218,8 @@ impl ListWeightsQueryBuilder { record.weights_category.as_str() ).unwrap(), title: record.title, - description_markdown: record.description_markdown, - description_rendered_html: record.description_rendered_html, + maybe_description_markdown: record.maybe_description_markdown, + maybe_description_rendered_html: record.maybe_description_rendered_html, creator_user_token: UserToken::new_from_str(&record.creator_user_token), creator_ip_address: record.creator_ip_address, creator_set_visibility: Visibility::from_str( @@ -272,8 +272,8 @@ impl ListWeightsQueryBuilder { model_weights.weights_type, model_weights.weights_category, model_weights.title, - model_weights.description_markdown, - model_weights.description_rendered_html, + model_weights.maybe_description_markdown, + model_weights.maybe_description_rendered_html, model_weights.creator_user_token, model_weights.creator_ip_address, model_weights.creator_set_visibility, @@ -430,8 +430,8 @@ struct RawWeightJoinUser { pub title: String, - pub description_markdown: String, - pub description_rendered_html: String, + pub maybe_description_markdown: Option, + pub maybe_description_rendered_html: Option, pub creator_user_token: String, pub creator_ip_address: String, diff --git a/crates/lib/mysql_queries/src/queries/model_weights/migration/upsert_model_weight_from_voice_conversion_model.rs b/crates/lib/mysql_queries/src/queries/model_weights/migration/upsert_model_weight_from_voice_conversion_model.rs index f72f1f9b0d..dbf69e0f72 100644 --- a/crates/lib/mysql_queries/src/queries/model_weights/migration/upsert_model_weight_from_voice_conversion_model.rs +++ b/crates/lib/mysql_queries/src/queries/model_weights/migration/upsert_model_weight_from_voice_conversion_model.rs @@ -77,8 +77,8 @@ SET weights_category = ?, title = ?, maybe_cover_image_media_file_token = NULL, - description_markdown = ?, - description_rendered_html = ?, + maybe_description_markdown = ?, + maybe_description_rendered_html = ?, creator_user_token = ?, creator_ip_address = ?, @@ -110,8 +110,8 @@ ON DUPLICATE KEY UPDATE weights_category = ?, title = ?, maybe_cover_image_media_file_token = NULL, - description_markdown = ?, - description_rendered_html = ?, + maybe_description_markdown = ?, + maybe_description_rendered_html = ?, creator_user_token = ?, creator_ip_address = ?, creator_set_visibility = ?, diff --git a/crates/lib/mysql_queries/src/queries/model_weights/table_reference.sql b/crates/lib/mysql_queries/src/queries/model_weights/table_reference.sql index 736a762556..77d3756994 100644 --- a/crates/lib/mysql_queries/src/queries/model_weights/table_reference.sql +++ b/crates/lib/mysql_queries/src/queries/model_weights/table_reference.sql @@ -4,8 +4,8 @@ CREATE TABLE model_weights ( weights_type VARCHAR(32) NOT NULL, weights_category VARCHAR(32) NOT NULL, title VARCHAR(255) NOT NULL, - description_markdown TEXT NOT NULL, - description_rendered_html TEXT NOT NULL, + maybe_description_markdown TEXT DEFAULT NULL, + maybe_description_rendered_html TEXT DEFAULT NULL, creator_user_token VARCHAR(32) NOT NULL, creator_ip_address VARCHAR(40) NOT NULL, creator_set_visibility ENUM( diff --git a/crates/lib/mysql_queries/src/queries/model_weights/tests.rs b/crates/lib/mysql_queries/src/queries/model_weights/tests.rs index b888fd1848..e45842810d 100644 --- a/crates/lib/mysql_queries/src/queries/model_weights/tests.rs +++ b/crates/lib/mysql_queries/src/queries/model_weights/tests.rs @@ -1,3 +1,4 @@ +#[ignore] #[cfg(test)] mod tests { use anyhow::Ok; @@ -65,8 +66,8 @@ mod tests { weights_type: WeightsType::RvcV2, // replace with actual WeightsType weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory title: "Title 1".to_string(), - description_markdown: "Description 1".to_string(), - description_rendered_html: "

Description 1

".to_string(), + maybe_description_markdown: Some("Description 1".to_string()), + maybe_description_rendered_html: Some("

Description 1

".to_string()), creator_user_token: Some(&creator_token1), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, @@ -97,8 +98,8 @@ mod tests { assert_eq!(result.title, "Title 1".to_string()); assert_eq!(result.weights_type, WeightsType::RvcV2); assert_eq!(result.weights_category, WeightsCategory::VoiceConversion); - assert_eq!(result.description_markdown, "Description 1".to_string()); - assert_eq!(result.description_rendered_html, "

Description 1

".to_string()); + assert_eq!(result.maybe_description_markdown, Some("Description 1".to_string())); + assert_eq!(result.maybe_description_rendered_html, Some("

Description 1

".to_string())); assert_eq!(result.creator_user_token, creator_token1); assert_eq!(result.creator_ip_address, "192.168.1.1".to_string()); assert_eq!(result.creator_set_visibility, Visibility::Public); @@ -138,8 +139,8 @@ mod tests { weights_type: WeightsType::RvcV2, // replace with actual WeightsType weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory title: "Title 1".to_string(), - description_markdown: "Description 1".to_string(), - description_rendered_html: "

Description 1

".to_string(), + maybe_description_markdown: Some("Description 1".to_string()), + maybe_description_rendered_html: Some("

Description 1

".to_string()), creator_user_token: Some(&creator_token1), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, @@ -214,8 +215,8 @@ mod tests { weights_type: WeightsType::RvcV2, // replace with actual WeightsType weights_category: WeightsCategory::VoiceConversion, // replace with actual WeightsCategory title: "Title 1".to_string(), - description_markdown: "Description 1".to_string(), - description_rendered_html: "

Description 1

".to_string(), + maybe_description_markdown: Some("Description 1".to_string()), + maybe_description_rendered_html: Some("

Description 1

".to_string()), creator_user_token: Some(&creator_token1), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, @@ -325,11 +326,11 @@ mod tests { let args = CreateModelWeightsArgs { token: &model_weight_token, // replace with actual ModelWeightToken - weights_type: weights_type, // replace with actual WeightsType - weights_category: weights_category, // replace with actual WeightsCategory + weights_type, // replace with actual WeightsType + weights_category, // replace with actual WeightsCategory title: format!("Title {}", i), - description_markdown: format!("Description {}", i), - description_rendered_html: format!("

Description {}

", i), + maybe_description_markdown: Some(format!("Description {}", i)), + maybe_description_rendered_html: Some(format!("

Description {}

", i)), creator_user_token: Some(&creator_token), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, @@ -567,11 +568,11 @@ mod tests { let args = CreateModelWeightsArgs { token: &model_weight_token, // replace with actual ModelWeightToken - weights_type: weights_type, // replace with actual WeightsType - weights_category: weights_category, // replace with actual WeightsCategory + weights_type, // replace with actual WeightsType + weights_category, // replace with actual WeightsCategory title: format!("Title {}", i), - description_markdown: format!("Description {}", i), - description_rendered_html: format!("

Description {}

", i), + maybe_description_markdown: Some(format!("Description {}", i)), + maybe_description_rendered_html: Some(format!("

Description {}

", i)), creator_user_token: Some(&creator_token), // replace with actual UserToken creator_ip_address: "192.168.1.1", creator_set_visibility: Visibility::Public, diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/get_weight.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/get_weight.rs index 05a62afcea..d39a2a1cff 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/get_weight.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/get_weight.rs @@ -26,7 +26,11 @@ pub struct GetWeightResponse { title: String, weights_type: WeightsType, weights_category: WeightsCategory, + + // TODO(bt,2023-12-24): Migrated the column. We should return nullables, but I don't want to break the frontend description_markdown: String, + + // TODO(bt,2023-12-24): Migrated the column. We should return nullables, but I don't want to break the frontend description_rendered_html: String, creator: UserDetailsLight, @@ -168,8 +172,9 @@ pub async fn get_weight_handler( title: weight.title, weights_type: weight.weights_type, weights_category: weight.weights_category, - description_markdown: weight.description_markdown, - description_rendered_html: weight.description_rendered_html, + // TODO(bt,2023-12-24): Migrated the column. We should return nullable fields, but I don't want to break the frontend + description_markdown: weight.maybe_description_markdown.unwrap_or_else(|| "".to_string()), + description_rendered_html: weight.maybe_description_rendered_html.unwrap_or_else(|| "".to_string()), maybe_cover_image_public_bucket_path: maybe_cover_image, creator, creator_set_visibility: weight.creator_set_visibility, diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_available_weights.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_available_weights.rs index cea22ff891..2694c5dbcf 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_available_weights.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_available_weights.rs @@ -53,8 +53,10 @@ pub struct ModelWeightForList { pub title: String, - pub description_markdown: String, - pub description_rendered_html: String, + // TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint. + // Hopefully we don't break the frontend by omitting these. + //pub description_markdown: String, + //pub description_rendered_html: String, /// Cover images are small descriptive images that can be set for any model. /// If a cover image is set, this is the path to the asset. @@ -259,8 +261,6 @@ pub async fn list_available_weights_handler( weights_type: weight.weights_type, weights_category: weight.weights_category, - description_markdown: weight.description_markdown, - description_rendered_html: weight.description_rendered_html, maybe_cover_image_public_bucket_path: maybe_cover_image, creator: UserDetailsLight::from_db_fields( diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_weights_by_user.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_weights_by_user.rs index 9f6981544c..dfdc679dca 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_weights_by_user.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/list_weights_by_user.rs @@ -27,8 +27,10 @@ pub struct Weight { creator: UserDetailsLight, creator_set_visibility: Visibility, - description_markdown: String, - description_rendered_html: String, + // TODO(bt,2023-12-24): These aren't really appropriate for a list endpoint. + // Hopefully we don't break the frontend by omitting these. + //description_markdown: String, + //description_rendered_html: String, file_size_bytes: i32, file_checksum_sha2: String, @@ -180,8 +182,8 @@ pub async fn list_weights_by_user_handler( &weight.creator_email_gravatar_hash, ), maybe_cover_image_public_bucket_path: maybe_cover_image, - description_markdown: weight.description_markdown, - description_rendered_html: weight.description_rendered_html, + //description_markdown: weight.maybe_description_markdown, + //description_rendered_html: weight.maybe_description_rendered_html, file_size_bytes: weight.file_size_bytes, file_checksum_sha2: weight.file_checksum_sha2, cached_user_ratings_total_count: weight.cached_user_ratings_total_count, diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/update_weight.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/update_weight.rs index cbc2642d4b..6db56cf1eb 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/weights/update_weight.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/weights/update_weight.rs @@ -143,8 +143,8 @@ pub async fn update_weight_handler( weight_token: &ModelWeightToken::new(path.weight_token.clone()), mysql_pool: &server_state.mysql_pool, title: request.title.as_deref(), - description_markdown: request.description_markdown.as_deref(), - description_rendered_html: request.description_rendered_html.as_deref(), + maybe_description_markdown: request.description_markdown.as_deref(), + maybe_description_rendered_html: request.description_rendered_html.as_deref(), creator_set_visibility: request.visibility.as_ref(), weights_type: request.weight_type.as_deref().map(|s| s.to_string()), weights_category: request.weight_category.as_deref().map(|s| s.to_string()),