Compare commits

..
7 Commits
562 changed files with 3904 additions and 16486 deletions
-1
View File
@@ -50,7 +50,6 @@
<w>unpermitted</w>
<w>upserting</w>
<w>upserts</w>
<w>upvoted</w>
<w>vits</w>
<w>vocoded</w>
<w>vocoder</w>
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nINSERT INTO media_files\nSET\n token = ?,\n\n media_class = ?,\n media_type = ?,\n\n origin_category = ?,\n origin_product_category = ?,\n maybe_origin_model_type = ?,\n\n maybe_mime_type = ?,\n file_size_bytes = ?,\n\n checksum_sha2 = ?,\n\n maybe_style_transfer_source_media_file_token = ?,\n maybe_scene_source_media_file_token = ?,\n\n maybe_title = ?,\n maybe_prompt_token = ?,\n\n public_bucket_directory_hash = ?,\n maybe_public_bucket_prefix = ?,\n maybe_public_bucket_extension = ?,\n\n maybe_creator_user_token = ?,\n maybe_creator_anonymous_visitor_token = ?,\n creator_ip_address = ?,\n\n creator_set_visibility = ?,\n\n maybe_creator_file_synthetic_id = ?,\n maybe_creator_category_synthetic_id = ?,\n\n is_generated_on_prem = ?,\n generated_by_worker = ?,\n generated_by_cluster = ?\n\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 25
},
"nullable": []
},
"hash": "039c24023c93deacc0b09fbbfe747821ba9f7e06bc17f651628edf1a82f5feb6"
}
@@ -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.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n\n wt.maybe_ietf_language_tag,\n wt.maybe_ietf_primary_language_subtag,\n\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 entity_stats.ratings_positive_count as maybe_ratings_positive_count,\n entity_stats.ratings_negative_count as maybe_ratings_negative_count,\n entity_stats.bookmark_count as maybe_bookmark_count,\n wt.cached_usage_count,\n\n featured_items.entity_token IS NOT NULL AS is_featured,\n\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n\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 LEFT OUTER JOIN entity_stats\n ON entity_stats.entity_type = \"model_weight\"\n AND entity_stats.entity_token = wt.token\n LEFT OUTER JOIN featured_items\n ON featured_items.entity_type = \"model_weight\"\n AND featured_items.entity_token = wt.token\n AND featured_items.deleted_at IS NULL\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 entity_stats.ratings_positive_count as maybe_ratings_positive_count,\n entity_stats.ratings_negative_count as maybe_ratings_negative_count,\n entity_stats.bookmark_count as maybe_bookmark_count,\n wt.cached_usage_count,\n\n featured_items.entity_token IS NOT NULL AS is_featured,\n\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n\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 LEFT OUTER JOIN entity_stats\n ON entity_stats.entity_type = \"model_weight\"\n AND entity_stats.entity_token = wt.token\n LEFT OUTER JOIN featured_items\n ON featured_items.entity_type = \"model_weight\"\n AND featured_items.entity_token = wt.token\n AND featured_items.deleted_at IS NULL\n WHERE\n wt.token = ?\n AND wt.user_deleted_at IS NULL\n AND wt.mod_deleted_at IS NULL\n ",
"describe": {
"columns": [
{
@@ -65,26 +65,6 @@
},
{
"ordinal": 6,
"name": "maybe_ietf_language_tag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 7,
"name": "maybe_ietf_primary_language_subtag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 48
}
},
{
"ordinal": 8,
"name": "creator_ip_address",
"type_info": {
"type": "VarString",
@@ -94,7 +74,7 @@
}
},
{
"ordinal": 9,
"ordinal": 7,
"name": "creator_set_visibility: enums::common::visibility::Visibility",
"type_info": {
"type": "String",
@@ -104,7 +84,7 @@
}
},
{
"ordinal": 10,
"ordinal": 8,
"name": "creator_user_token: tokens::tokens::users::UserToken",
"type_info": {
"type": "VarString",
@@ -114,7 +94,7 @@
}
},
{
"ordinal": 11,
"ordinal": 9,
"name": "creator_username",
"type_info": {
"type": "VarString",
@@ -124,7 +104,7 @@
}
},
{
"ordinal": 12,
"ordinal": 10,
"name": "creator_display_name",
"type_info": {
"type": "VarString",
@@ -134,7 +114,7 @@
}
},
{
"ordinal": 13,
"ordinal": 11,
"name": "creator_gravatar_hash",
"type_info": {
"type": "String",
@@ -144,7 +124,7 @@
}
},
{
"ordinal": 14,
"ordinal": 12,
"name": "maybe_last_update_user_token: tokens::tokens::users::UserToken",
"type_info": {
"type": "VarString",
@@ -154,7 +134,7 @@
}
},
{
"ordinal": 15,
"ordinal": 13,
"name": "original_download_url",
"type_info": {
"type": "VarString",
@@ -164,7 +144,7 @@
}
},
{
"ordinal": 16,
"ordinal": 14,
"name": "original_filename",
"type_info": {
"type": "VarString",
@@ -174,7 +154,7 @@
}
},
{
"ordinal": 17,
"ordinal": 15,
"name": "file_size_bytes",
"type_info": {
"type": "LongLong",
@@ -184,7 +164,7 @@
}
},
{
"ordinal": 18,
"ordinal": 16,
"name": "file_checksum_sha2",
"type_info": {
"type": "String",
@@ -194,7 +174,7 @@
}
},
{
"ordinal": 19,
"ordinal": 17,
"name": "public_bucket_hash",
"type_info": {
"type": "VarString",
@@ -204,7 +184,7 @@
}
},
{
"ordinal": 20,
"ordinal": 18,
"name": "maybe_public_bucket_prefix",
"type_info": {
"type": "VarString",
@@ -214,7 +194,7 @@
}
},
{
"ordinal": 21,
"ordinal": 19,
"name": "maybe_public_bucket_extension",
"type_info": {
"type": "VarString",
@@ -224,7 +204,7 @@
}
},
{
"ordinal": 22,
"ordinal": 20,
"name": "maybe_cover_image_public_bucket_hash",
"type_info": {
"type": "VarString",
@@ -234,7 +214,7 @@
}
},
{
"ordinal": 23,
"ordinal": 21,
"name": "maybe_cover_image_public_bucket_prefix",
"type_info": {
"type": "VarString",
@@ -244,7 +224,7 @@
}
},
{
"ordinal": 24,
"ordinal": 22,
"name": "maybe_cover_image_public_bucket_extension",
"type_info": {
"type": "VarString",
@@ -254,7 +234,7 @@
}
},
{
"ordinal": 25,
"ordinal": 23,
"name": "maybe_ratings_positive_count",
"type_info": {
"type": "Long",
@@ -264,7 +244,7 @@
}
},
{
"ordinal": 26,
"ordinal": 24,
"name": "maybe_ratings_negative_count",
"type_info": {
"type": "Long",
@@ -274,7 +254,7 @@
}
},
{
"ordinal": 27,
"ordinal": 25,
"name": "maybe_bookmark_count",
"type_info": {
"type": "Long",
@@ -284,7 +264,7 @@
}
},
{
"ordinal": 28,
"ordinal": 26,
"name": "cached_usage_count",
"type_info": {
"type": "LongLong",
@@ -294,7 +274,7 @@
}
},
{
"ordinal": 29,
"ordinal": 27,
"name": "is_featured",
"type_info": {
"type": "LongLong",
@@ -304,7 +284,7 @@
}
},
{
"ordinal": 30,
"ordinal": 28,
"name": "version",
"type_info": {
"type": "Long",
@@ -314,7 +294,7 @@
}
},
{
"ordinal": 31,
"ordinal": 29,
"name": "created_at",
"type_info": {
"type": "Timestamp",
@@ -324,7 +304,7 @@
}
},
{
"ordinal": 32,
"ordinal": 30,
"name": "updated_at",
"type_info": {
"type": "Timestamp",
@@ -334,7 +314,7 @@
}
},
{
"ordinal": 33,
"ordinal": 31,
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
@@ -344,7 +324,7 @@
}
},
{
"ordinal": 34,
"ordinal": 32,
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
@@ -364,8 +344,6 @@
false,
true,
true,
true,
true,
false,
false,
false,
@@ -395,5 +373,5 @@
true
]
},
"hash": "29fe7f8464257537840d7f095ec01f850d79f970109549d14978fc3bed7cef32"
"hash": "1053294a21439ddb41fdd1053547b3f5c50457f6ba9450e5167a1db5caf896d1"
}
@@ -1,36 +0,0 @@
{
"db_name": "MySQL",
"query": "\nSELECT\n t.token as `token: tokens::tokens::tags::TagToken`,\n t.tag_value\n\nFROM\n tags AS t\nJOIN tag_uses AS u\n ON t.token = u.tag_token\nWHERE\n u.entity_type = ?\n AND u.entity_token = ?\n AND u.maybe_deleted_at IS NULL\nORDER BY t.id DESC\nLIMIT 500\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token: tokens::tokens::tags::TagToken",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 1,
"name": "tag_value",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 1020
}
}
],
"parameters": {
"Right": 2
},
"nullable": [
false,
false
]
},
"hash": "3929e9fe74e75fad7252681880c6c3bd7e76e96b0bf603f77f6a9b2d4fcda18d"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nDELETE FROM tag_uses\nWHERE entity_type = ?\nAND entity_token = ?\nLIMIT 1\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 2
},
"nullable": []
},
"hash": "41b16ccf04ef1ffb8b48bc59edf9389f61f54b871f6361f35529706b98d419ec"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nINSERT INTO users\nSET\n token = ?,\n username = ?,\n display_name = ?,\n\n username_is_generated = ?,\n username_is_not_customized = ?,\n\n email_address = ?,\n email_gravatar_hash = ?,\n\n email_confirmed = FALSE,\n email_confirmed_by_google = ?,\n\n profile_markdown = ?,\n profile_rendered_html = ?,\n user_role_slug = ?,\n\n password_hash = ?,\n is_without_password = ?,\n\n maybe_feature_flags = ?,\n\n ip_address_creation = ?,\n ip_address_last_login = ?,\n ip_address_last_update = ?,\n\n maybe_source = ?,\n\n maybe_signup_method = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 19
},
"nullable": []
},
"hash": "453f0386cfe34e533501ba29dc2022fc449266f9858f16886bde9a0df6b82026"
}
@@ -1,6 +1,6 @@
{
"db_name": "MySQL",
"query": "\nSELECT\n token as `token: tokens::tokens::users::UserToken`,\n username,\n display_name,\n username_is_not_customized,\n email_address,\n password_hash as `password_hash: crate::queries::users::user::get::lookup_user_for_login_result::VecBytes`,\n password_version,\n is_banned,\n maybe_feature_flags\nFROM users\nWHERE username = ?\nLIMIT 1\n ",
"query": "\nSELECT\n token as `token: tokens::tokens::users::UserToken`,\n username,\n email_address,\n password_hash as `password_hash: crate::queries::users::user::lookup_user_for_login_result::VecBytes`,\n password_version,\n is_banned,\n maybe_feature_flags\nFROM users\nWHERE email_address = ?\nLIMIT 1\n ",
"describe": {
"columns": [
{
@@ -25,26 +25,6 @@
},
{
"ordinal": 2,
"name": "display_name",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 80
}
},
{
"ordinal": 3,
"name": "username_is_not_customized",
"type_info": {
"type": "Tiny",
"flags": "NOT_NULL",
"char_set": 63,
"max_size": 1
}
},
{
"ordinal": 4,
"name": "email_address",
"type_info": {
"type": "VarString",
@@ -54,8 +34,8 @@
}
},
{
"ordinal": 5,
"name": "password_hash: crate::queries::users::user::get::lookup_user_for_login_result::VecBytes",
"ordinal": 3,
"name": "password_hash: crate::queries::users::user::lookup_user_for_login_result::VecBytes",
"type_info": {
"type": "String",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
@@ -64,7 +44,7 @@
}
},
{
"ordinal": 6,
"ordinal": 4,
"name": "password_version",
"type_info": {
"type": "Long",
@@ -74,7 +54,7 @@
}
},
{
"ordinal": 7,
"ordinal": 5,
"name": "is_banned",
"type_info": {
"type": "Tiny",
@@ -84,7 +64,7 @@
}
},
{
"ordinal": 8,
"ordinal": 6,
"name": "maybe_feature_flags",
"type_info": {
"type": "VarString",
@@ -104,10 +84,8 @@
false,
false,
false,
false,
false,
true
]
},
"hash": "2bc80729a61545b39cc633ca79af612ce611d358b32149405340d985060d4bbe"
"hash": "48889cc9c9b8dbe482e74687629a6958c1c9bf8a1cd5ae177afea0ad0709736d"
}
@@ -1,6 +1,6 @@
{
"db_name": "MySQL",
"query": "\nSELECT\n w.id,\n w.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n\n w.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n w.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n w.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n\n w.title,\n\n w.maybe_ietf_language_tag,\n w.maybe_ietf_primary_language_subtag,\n\n cover_image.token as `maybe_cover_image_media_file_token: tokens::tokens::media_files::MediaFileToken`,\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 w.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 featured_items.entity_token IS NOT NULL AS is_featured,\n\n entity_stats.ratings_positive_count as maybe_ratings_positive_count,\n entity_stats.ratings_negative_count as maybe_ratings_negative_count,\n entity_stats.bookmark_count as maybe_bookmark_count,\n\n w.cached_usage_count,\n\n extension_tts.ietf_language_tag as maybe_tts_ietf_language_tag,\n extension_tts.ietf_primary_language_subtag as maybe_tts_ietf_primary_language_subtag,\n\n extension_vc.ietf_language_tag as maybe_vc_ietf_language_tag,\n extension_vc.ietf_primary_language_subtag as maybe_vc_ietf_primary_language_subtag,\n\n w.created_at,\n w.updated_at,\n w.user_deleted_at,\n w.mod_deleted_at,\n\n NOW() as database_read_time\n\nFROM model_weights as w\n\nJOIN users\n ON users.token = w.creator_user_token\n\nLEFT OUTER JOIN model_weights_extension_tts_details as extension_tts\n ON extension_tts.model_weights_token = w.token\nLEFT OUTER JOIN model_weights_extension_voice_conversion_details as extension_vc\n ON extension_vc.model_weights_token = w.token\nLEFT OUTER JOIN entity_stats\n ON entity_stats.entity_type = \"model_weight\"\n AND entity_stats.entity_token = w.token\nLEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = w.maybe_cover_image_media_file_token\nLEFT OUTER JOIN featured_items\n ON featured_items.entity_type = \"model_weight\"\n AND featured_items.entity_token = w.token\n AND featured_items.deleted_at IS NULL\n\nWHERE\n w.id > ?\nORDER BY id ASC\nLIMIT ?\n ",
"query": "\nSELECT\n w.id,\n w.token as `token: tokens::tokens::model_weights::ModelWeightToken`,\n\n w.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,\n\n w.weights_type as `weights_type: enums::by_table::model_weights::weights_types::WeightsType`,\n w.weights_category as `weights_category: enums::by_table::model_weights::weights_category::WeightsCategory`,\n\n w.title,\n\n cover_image.token as `maybe_cover_image_media_file_token: tokens::tokens::media_files::MediaFileToken`,\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 w.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 featured_items.entity_token IS NOT NULL AS is_featured,\n\n entity_stats.ratings_positive_count as maybe_ratings_positive_count,\n entity_stats.ratings_negative_count as maybe_ratings_negative_count,\n entity_stats.bookmark_count as maybe_bookmark_count,\n\n w.cached_usage_count,\n\n extension_tts.ietf_language_tag as maybe_tts_ietf_language_tag,\n extension_tts.ietf_primary_language_subtag as maybe_tts_ietf_primary_language_subtag,\n\n extension_vc.ietf_language_tag as maybe_vc_ietf_language_tag,\n extension_vc.ietf_primary_language_subtag as maybe_vc_ietf_primary_language_subtag,\n\n w.created_at,\n w.updated_at,\n w.user_deleted_at,\n w.mod_deleted_at,\n\n NOW() as database_read_time\n\nFROM model_weights as w\n\nJOIN users\n ON users.token = w.creator_user_token\n\nLEFT OUTER JOIN model_weights_extension_tts_details as extension_tts\n ON extension_tts.model_weights_token = w.token\nLEFT OUTER JOIN model_weights_extension_voice_conversion_details as extension_vc\n ON extension_vc.model_weights_token = w.token\nLEFT OUTER JOIN entity_stats\n ON entity_stats.entity_type = \"model_weight\"\n AND entity_stats.entity_token = w.token\nLEFT OUTER JOIN media_files as cover_image\n ON cover_image.token = w.maybe_cover_image_media_file_token\nLEFT OUTER JOIN featured_items\n ON featured_items.entity_type = \"model_weight\"\n AND featured_items.entity_token = w.token\n AND featured_items.deleted_at IS NULL\n\nWHERE\n w.id > ?\nORDER BY id ASC\nLIMIT ?\n ",
"describe": {
"columns": [
{
@@ -65,26 +65,6 @@
},
{
"ordinal": 6,
"name": "maybe_ietf_language_tag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 7,
"name": "maybe_ietf_primary_language_subtag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 48
}
},
{
"ordinal": 8,
"name": "maybe_cover_image_media_file_token: tokens::tokens::media_files::MediaFileToken",
"type_info": {
"type": "VarString",
@@ -94,7 +74,7 @@
}
},
{
"ordinal": 9,
"ordinal": 7,
"name": "maybe_cover_image_public_bucket_hash",
"type_info": {
"type": "VarString",
@@ -104,7 +84,7 @@
}
},
{
"ordinal": 10,
"ordinal": 8,
"name": "maybe_cover_image_public_bucket_prefix",
"type_info": {
"type": "VarString",
@@ -114,7 +94,7 @@
}
},
{
"ordinal": 11,
"ordinal": 9,
"name": "maybe_cover_image_public_bucket_extension",
"type_info": {
"type": "VarString",
@@ -124,7 +104,7 @@
}
},
{
"ordinal": 12,
"ordinal": 10,
"name": "creator_user_token: tokens::tokens::users::UserToken",
"type_info": {
"type": "VarString",
@@ -134,7 +114,7 @@
}
},
{
"ordinal": 13,
"ordinal": 11,
"name": "creator_username",
"type_info": {
"type": "VarString",
@@ -144,7 +124,7 @@
}
},
{
"ordinal": 14,
"ordinal": 12,
"name": "creator_display_name",
"type_info": {
"type": "VarString",
@@ -154,7 +134,7 @@
}
},
{
"ordinal": 15,
"ordinal": 13,
"name": "creator_gravatar_hash",
"type_info": {
"type": "String",
@@ -164,7 +144,7 @@
}
},
{
"ordinal": 16,
"ordinal": 14,
"name": "is_featured",
"type_info": {
"type": "LongLong",
@@ -174,7 +154,7 @@
}
},
{
"ordinal": 17,
"ordinal": 15,
"name": "maybe_ratings_positive_count",
"type_info": {
"type": "Long",
@@ -184,7 +164,7 @@
}
},
{
"ordinal": 18,
"ordinal": 16,
"name": "maybe_ratings_negative_count",
"type_info": {
"type": "Long",
@@ -194,7 +174,7 @@
}
},
{
"ordinal": 19,
"ordinal": 17,
"name": "maybe_bookmark_count",
"type_info": {
"type": "Long",
@@ -204,7 +184,7 @@
}
},
{
"ordinal": 20,
"ordinal": 18,
"name": "cached_usage_count",
"type_info": {
"type": "LongLong",
@@ -214,7 +194,7 @@
}
},
{
"ordinal": 21,
"ordinal": 19,
"name": "maybe_tts_ietf_language_tag",
"type_info": {
"type": "VarString",
@@ -224,7 +204,7 @@
}
},
{
"ordinal": 22,
"ordinal": 20,
"name": "maybe_tts_ietf_primary_language_subtag",
"type_info": {
"type": "VarString",
@@ -234,7 +214,7 @@
}
},
{
"ordinal": 23,
"ordinal": 21,
"name": "maybe_vc_ietf_language_tag",
"type_info": {
"type": "VarString",
@@ -244,7 +224,7 @@
}
},
{
"ordinal": 24,
"ordinal": 22,
"name": "maybe_vc_ietf_primary_language_subtag",
"type_info": {
"type": "VarString",
@@ -254,7 +234,7 @@
}
},
{
"ordinal": 25,
"ordinal": 23,
"name": "created_at",
"type_info": {
"type": "Timestamp",
@@ -264,7 +244,7 @@
}
},
{
"ordinal": 26,
"ordinal": 24,
"name": "updated_at",
"type_info": {
"type": "Timestamp",
@@ -274,7 +254,7 @@
}
},
{
"ordinal": 27,
"ordinal": 25,
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
@@ -284,7 +264,7 @@
}
},
{
"ordinal": 28,
"ordinal": 26,
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
@@ -294,7 +274,7 @@
}
},
{
"ordinal": 29,
"ordinal": 27,
"name": "database_read_time",
"type_info": {
"type": "Datetime",
@@ -318,8 +298,6 @@
true,
true,
true,
true,
true,
false,
false,
false,
@@ -340,5 +318,5 @@
false
]
},
"hash": "d0f9d2cf4176c3f7f8fbff66eb6ff9415d989afc2b5944629a7bcea4b5a822f3"
"hash": "4bce2b10f0510feca7f5705049a5c0eaae6e1a840146628495827468a38c05dd"
}
@@ -0,0 +1,12 @@
{
"db_name": "MySQL",
"query": "\nINSERT INTO users (\n token,\n username,\n display_name,\n email_address,\n email_gravatar_hash,\n profile_markdown,\n profile_rendered_html,\n user_role_slug,\n password_hash,\n ip_address_creation,\n ip_address_last_login,\n ip_address_last_update,\n maybe_source\n)\nVALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 13
},
"nullable": []
},
"hash": "58a2d6d0c5541049cc954e3ac09b3aaef894ca55e1cb7444b72f429394022f12"
}
@@ -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.maybe_description_markdown,\n wt.maybe_description_rendered_html,\n\n wt.maybe_ietf_language_tag,\n wt.maybe_ietf_primary_language_subtag,\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 entity_stats.ratings_positive_count as maybe_ratings_positive_count,\n entity_stats.ratings_negative_count as maybe_ratings_negative_count,\n entity_stats.bookmark_count as maybe_bookmark_count,\n wt.cached_usage_count,\n\n featured_items.entity_token IS NOT NULL AS is_featured,\n\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n\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 LEFT OUTER JOIN entity_stats\n ON entity_stats.entity_type = \"model_weight\"\n AND entity_stats.entity_token = wt.token\n LEFT OUTER JOIN featured_items\n ON featured_items.entity_type = \"model_weight\"\n AND featured_items.entity_token = wt.token\n AND featured_items.deleted_at IS NULL\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 entity_stats.ratings_positive_count as maybe_ratings_positive_count,\n entity_stats.ratings_negative_count as maybe_ratings_negative_count,\n entity_stats.bookmark_count as maybe_bookmark_count,\n wt.cached_usage_count,\n\n featured_items.entity_token IS NOT NULL AS is_featured,\n\n wt.version,\n wt.created_at,\n wt.updated_at,\n wt.user_deleted_at,\n wt.mod_deleted_at\n\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 LEFT OUTER JOIN entity_stats\n ON entity_stats.entity_type = \"model_weight\"\n AND entity_stats.entity_token = wt.token\n LEFT OUTER JOIN featured_items\n ON featured_items.entity_type = \"model_weight\"\n AND featured_items.entity_token = wt.token\n AND featured_items.deleted_at IS NULL\n WHERE\n wt.token = ?\n ",
"describe": {
"columns": [
{
@@ -65,26 +65,6 @@
},
{
"ordinal": 6,
"name": "maybe_ietf_language_tag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 256
}
},
{
"ordinal": 7,
"name": "maybe_ietf_primary_language_subtag",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 48
}
},
{
"ordinal": 8,
"name": "creator_user_token: tokens::tokens::users::UserToken",
"type_info": {
"type": "VarString",
@@ -94,7 +74,7 @@
}
},
{
"ordinal": 9,
"ordinal": 7,
"name": "creator_username",
"type_info": {
"type": "VarString",
@@ -104,7 +84,7 @@
}
},
{
"ordinal": 10,
"ordinal": 8,
"name": "creator_display_name",
"type_info": {
"type": "VarString",
@@ -114,7 +94,7 @@
}
},
{
"ordinal": 11,
"ordinal": 9,
"name": "creator_gravatar_hash",
"type_info": {
"type": "String",
@@ -124,7 +104,7 @@
}
},
{
"ordinal": 12,
"ordinal": 10,
"name": "creator_ip_address",
"type_info": {
"type": "VarString",
@@ -134,7 +114,7 @@
}
},
{
"ordinal": 13,
"ordinal": 11,
"name": "creator_set_visibility: enums::common::visibility::Visibility",
"type_info": {
"type": "String",
@@ -144,7 +124,7 @@
}
},
{
"ordinal": 14,
"ordinal": 12,
"name": "maybe_last_update_user_token: tokens::tokens::users::UserToken",
"type_info": {
"type": "VarString",
@@ -154,7 +134,7 @@
}
},
{
"ordinal": 15,
"ordinal": 13,
"name": "original_download_url",
"type_info": {
"type": "VarString",
@@ -164,7 +144,7 @@
}
},
{
"ordinal": 16,
"ordinal": 14,
"name": "original_filename",
"type_info": {
"type": "VarString",
@@ -174,7 +154,7 @@
}
},
{
"ordinal": 17,
"ordinal": 15,
"name": "file_size_bytes",
"type_info": {
"type": "LongLong",
@@ -184,7 +164,7 @@
}
},
{
"ordinal": 18,
"ordinal": 16,
"name": "file_checksum_sha2",
"type_info": {
"type": "String",
@@ -194,7 +174,7 @@
}
},
{
"ordinal": 19,
"ordinal": 17,
"name": "public_bucket_hash",
"type_info": {
"type": "VarString",
@@ -204,7 +184,7 @@
}
},
{
"ordinal": 20,
"ordinal": 18,
"name": "maybe_public_bucket_prefix",
"type_info": {
"type": "VarString",
@@ -214,7 +194,7 @@
}
},
{
"ordinal": 21,
"ordinal": 19,
"name": "maybe_public_bucket_extension",
"type_info": {
"type": "VarString",
@@ -224,7 +204,7 @@
}
},
{
"ordinal": 22,
"ordinal": 20,
"name": "maybe_cover_image_public_bucket_hash",
"type_info": {
"type": "VarString",
@@ -234,7 +214,7 @@
}
},
{
"ordinal": 23,
"ordinal": 21,
"name": "maybe_cover_image_public_bucket_prefix",
"type_info": {
"type": "VarString",
@@ -244,7 +224,7 @@
}
},
{
"ordinal": 24,
"ordinal": 22,
"name": "maybe_cover_image_public_bucket_extension",
"type_info": {
"type": "VarString",
@@ -254,7 +234,7 @@
}
},
{
"ordinal": 25,
"ordinal": 23,
"name": "maybe_ratings_positive_count",
"type_info": {
"type": "Long",
@@ -264,7 +244,7 @@
}
},
{
"ordinal": 26,
"ordinal": 24,
"name": "maybe_ratings_negative_count",
"type_info": {
"type": "Long",
@@ -274,7 +254,7 @@
}
},
{
"ordinal": 27,
"ordinal": 25,
"name": "maybe_bookmark_count",
"type_info": {
"type": "Long",
@@ -284,7 +264,7 @@
}
},
{
"ordinal": 28,
"ordinal": 26,
"name": "cached_usage_count",
"type_info": {
"type": "LongLong",
@@ -294,7 +274,7 @@
}
},
{
"ordinal": 29,
"ordinal": 27,
"name": "is_featured",
"type_info": {
"type": "LongLong",
@@ -304,7 +284,7 @@
}
},
{
"ordinal": 30,
"ordinal": 28,
"name": "version",
"type_info": {
"type": "Long",
@@ -314,7 +294,7 @@
}
},
{
"ordinal": 31,
"ordinal": 29,
"name": "created_at",
"type_info": {
"type": "Timestamp",
@@ -324,7 +304,7 @@
}
},
{
"ordinal": 32,
"ordinal": 30,
"name": "updated_at",
"type_info": {
"type": "Timestamp",
@@ -334,7 +314,7 @@
}
},
{
"ordinal": 33,
"ordinal": 31,
"name": "user_deleted_at",
"type_info": {
"type": "Timestamp",
@@ -344,7 +324,7 @@
}
},
{
"ordinal": 34,
"ordinal": 32,
"name": "mod_deleted_at",
"type_info": {
"type": "Timestamp",
@@ -364,8 +344,6 @@
false,
true,
true,
true,
true,
false,
false,
false,
@@ -395,5 +373,5 @@
true
]
},
"hash": "53c90f5230aa202aead37a224ec70e350172bc0ec4eeaebde22878ca4aa0f695"
"hash": "5e953a6ad7bcaaed0918109593652b03c7ab497cc65b59bbb6add011de6401f0"
}
@@ -1,168 +0,0 @@
{
"db_name": "MySQL",
"query": "\nSELECT\n g.token as `token: tokens::tokens::google_sign_in_accounts::GoogleSignInAccountToken`,\n\n g.subject,\n\n g.maybe_user_token as `maybe_user_token: tokens::tokens::users::UserToken`,\n\n g.email_address,\n g.is_email_verified,\n\n g.maybe_locale,\n g.maybe_name,\n g.maybe_given_name,\n g.maybe_family_name,\n\n g.created_at,\n g.updated_at,\n\n u.username as maybe_username,\n u.display_name as maybe_user_display_name,\n u.username_is_not_customized\n\nFROM google_sign_in_accounts AS g\nLEFT OUTER JOIN users AS u\n ON g.maybe_user_token = u.token\n\nWHERE\n g.subject = ?\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "token: tokens::tokens::google_sign_in_accounts::GoogleSignInAccountToken",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 1,
"name": "subject",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 2,
"name": "maybe_user_token: tokens::tokens::users::UserToken",
"type_info": {
"type": "VarString",
"flags": "MULTIPLE_KEY | BINARY",
"char_set": 224,
"max_size": 128
}
},
{
"ordinal": 3,
"name": "email_address",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 4,
"name": "is_email_verified",
"type_info": {
"type": "Tiny",
"flags": "NOT_NULL",
"char_set": 63,
"max_size": 1
}
},
{
"ordinal": 5,
"name": "maybe_locale",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 6,
"name": "maybe_name",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 7,
"name": "maybe_given_name",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 8,
"name": "maybe_family_name",
"type_info": {
"type": "VarString",
"flags": "BINARY",
"char_set": 224,
"max_size": 1020
}
},
{
"ordinal": 9,
"name": "created_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 10,
"name": "updated_at",
"type_info": {
"type": "Timestamp",
"flags": "NOT_NULL | MULTIPLE_KEY | BINARY | TIMESTAMP | ON_UPDATE_NOW",
"char_set": 63,
"max_size": 19
}
},
{
"ordinal": 11,
"name": "maybe_username",
"type_info": {
"type": "VarString",
"flags": "UNIQUE_KEY | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 80
}
},
{
"ordinal": 12,
"name": "maybe_user_display_name",
"type_info": {
"type": "VarString",
"flags": "BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 80
}
},
{
"ordinal": 13,
"name": "username_is_not_customized",
"type_info": {
"type": "Tiny",
"flags": "",
"char_set": 63,
"max_size": 1
}
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
true,
false,
false,
true,
true,
true,
true,
false,
false,
true,
true,
true
]
},
"hash": "76d9a995b3cecfcb39f1a41bb4896c4e317716dbde6b5f678bd9fd458544ab78"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nUPDATE generic_inference_jobs\nSET\n status = 'cancelled_by_user',\n retry_at = NULL\nWHERE status IN (\n 'pending',\n 'started',\n 'attempt_failed'\n )\nLIMIT 100\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 0
},
"nullable": []
},
"hash": "84320887e8157a450ad46ec0843071c60c054eab61958a9148789ed76cd476e3"
}
@@ -1,6 +1,6 @@
{
"db_name": "MySQL",
"query": "\nSELECT\n token as `token: tokens::tokens::users::UserToken`,\n username,\n display_name,\n username_is_not_customized,\n email_address,\n password_hash as `password_hash: crate::queries::users::user::get::lookup_user_for_login_result::VecBytes`,\n password_version,\n is_banned,\n maybe_feature_flags\nFROM users\nWHERE email_address = ?\nLIMIT 1\n ",
"query": "\nSELECT\n token as `token: tokens::tokens::users::UserToken`,\n username,\n email_address,\n password_hash as `password_hash: crate::queries::users::user::lookup_user_for_login_result::VecBytes`,\n password_version,\n is_banned,\n maybe_feature_flags\nFROM users\nWHERE username = ?\nLIMIT 1\n ",
"describe": {
"columns": [
{
@@ -25,26 +25,6 @@
},
{
"ordinal": 2,
"name": "display_name",
"type_info": {
"type": "VarString",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
"char_set": 224,
"max_size": 80
}
},
{
"ordinal": 3,
"name": "username_is_not_customized",
"type_info": {
"type": "Tiny",
"flags": "NOT_NULL",
"char_set": 63,
"max_size": 1
}
},
{
"ordinal": 4,
"name": "email_address",
"type_info": {
"type": "VarString",
@@ -54,8 +34,8 @@
}
},
{
"ordinal": 5,
"name": "password_hash: crate::queries::users::user::get::lookup_user_for_login_result::VecBytes",
"ordinal": 3,
"name": "password_hash: crate::queries::users::user::lookup_user_for_login_result::VecBytes",
"type_info": {
"type": "String",
"flags": "NOT_NULL | BINARY | NO_DEFAULT_VALUE",
@@ -64,7 +44,7 @@
}
},
{
"ordinal": 6,
"ordinal": 4,
"name": "password_version",
"type_info": {
"type": "Long",
@@ -74,7 +54,7 @@
}
},
{
"ordinal": 7,
"ordinal": 5,
"name": "is_banned",
"type_info": {
"type": "Tiny",
@@ -84,7 +64,7 @@
}
},
{
"ordinal": 8,
"ordinal": 6,
"name": "maybe_feature_flags",
"type_info": {
"type": "VarString",
@@ -104,10 +84,8 @@
false,
false,
false,
false,
false,
true
]
},
"hash": "a5b0ee8755f5bd81dc330e63fa8a1c02e6397e7914f4041d90b2bc9cfc249c17"
"hash": "8e577db7abde571a0f29fc9d678891349918f0882136d9f7a39b338f66270f11"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nINSERT INTO tags\nSET\n token = ?,\n tag_value = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 2
},
"nullable": []
},
"hash": "c7e848e4c906a34ac5a4ad8cc73354baa8d5cd81170dd06d66d7f414505d538b"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nUPDATE google_sign_in_accounts\nSET\n email_address = ?,\n is_email_verified = ?,\n\n maybe_locale = ?,\n\n maybe_name = ?,\n maybe_given_name = ?,\n maybe_family_name = ?,\n\n ip_address_update = ?,\n\n version = version + 1\nWHERE\n subject = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 8
},
"nullable": []
},
"hash": "cf30aa779c25b42e51b38f7301c7a1b19e5586a10d21fad5bf05e4edde481a65"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nINSERT INTO google_sign_in_accounts\nSET\n token = ?,\n subject = ?,\n\n maybe_user_token = ?,\n\n email_address = ?,\n is_email_verified = ?,\n\n maybe_locale = ?,\n\n maybe_name = ?,\n maybe_given_name = ?,\n maybe_family_name = ?,\n\n ip_address_creation = ?,\n ip_address_update = ?\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 11
},
"nullable": []
},
"hash": "e034a43787bce2ac2db23dee2e640d527f82b29133d29a3d3803aab905f9cab6"
}
@@ -1,12 +0,0 @@
{
"db_name": "MySQL",
"query": "\nUPDATE users\nSET\n username = ?,\n display_name = ?,\n username_is_not_customized = ?,\n ip_address_last_update = ?,\n version = version + 1\nWHERE\n token = ?\nLIMIT 1\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 5
},
"nullable": []
},
"hash": "f41980bd0f7e5ba680315095c773b406e589ea6e72b5c284a14440c5d1c57811"
}
Generated
+1136 -1415
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -3,6 +3,8 @@ resolver = "2"
members = [
# Types: common strongly-typed tokens, ids, payloads, etc.
# Also common cloud buckets and other "strongly typed" configs.
"crates/_types/buckets",
"crates/_types/composite_identifiers",
"crates/_types/enums",
"crates/_types/enums_public",
@@ -26,10 +28,8 @@ members = [
"crates/lib/actix_helpers",
"crates/lib/api_clients/cloud_storage",
"crates/lib/api_clients/google_drive_common",
"crates/lib/api_clients/google_sign_in",
"crates/lib/api_clients/thumbnail_generator",
"crates/lib/bootstrap",
"crates/lib/bucket_paths",
"crates/lib/caching/memory_caching",
"crates/lib/caching/redis_caching",
"crates/lib/concurrency",
@@ -1,15 +0,0 @@
-- User sign up histogram by method
-- Since we don't have an index on created_at, we threshold by id
-- Current ID count = 7578799 (September 28, 2024)
select
date(created_at) as date,
case
when maybe_signup_method is null then 'email_password'
else maybe_signup_method
end as method,
count(*) as signup_count
from users
where id > 7200000
and created_at >= NOW() - INTERVAL 60 DAY
group by date(created_at), method
@@ -1,14 +0,0 @@
-- User sign up histogram by method
-- Since we don't have an index on created_at, we threshold by id
-- Current ID count = 7578799 (September 28, 2024)
select
date(created_at) as date,
case
when maybe_source is null then 'unknown'
else maybe_source
end as source,
count(*) as signup_count
from users
where id > 7200000
and created_at >= NOW() - INTERVAL 60 DAY
group by date(created_at), maybe_source
@@ -7,14 +7,6 @@ select count(*)
from generic_inference_jobs
where status = 'pending';
-- Get pending job count by job type
select
job_type,
count(*)
from generic_inference_jobs
where status = 'pending'
group by job_type;
-- Kill *ALL* pending / outstanding jobs of any type
update generic_inference_jobs
set status = 'dead'
@@ -1,28 +0,0 @@
-- Find old stale jobs
select
job_type,
count(*)
from generic_inference_jobs
where status = 'started'
and created_at < (CURDATE() - INTERVAL 30 MINUTE)
group by job_type;
-- Kill old stale jobs
update generic_inference_jobs
set status = 'dead'
where status = 'started'
and created_at < (CURDATE() - INTERVAL 30 MINUTE)
-- Check up on recent jobs after purge
select
job_type,
count(*)
from generic_inference_jobs
where status = 'started'
group by job_type;
-- Kill old pending jobs too
update generic_inference_jobs
set status = 'dead'
where status = 'pending'
and created_at < (CURDATE() - INTERVAL 30 MINUTE)
@@ -1,69 +0,0 @@
-- Select popular models without cover images or language
select
mw.token,
mw.title,
mw.maybe_ietf_language_tag,
mw.maybe_cover_image_media_file_token,
count(*) as use_count
from generic_inference_jobs as gij
left outer join model_weights as mw
on gij.maybe_model_token = mw.token
where gij.created_at >= (CURDATE() - INTERVAL 5 DAY)
and (
mw.maybe_ietf_language_tag IS NULL
or mw.maybe_cover_image_media_file_token IS NULL
)
and mw.mod_deleted_at IS NULL
and mw.user_deleted_at IS NULL
group by
mw.token,
mw.title,
mw.maybe_ietf_language_tag,
mw.maybe_cover_image_media_file_token
order by use_count desc
limit 100;
-- Select popular models without streamer usage distorting the totals
select
mw.token,
mw.title,
mw.maybe_ietf_language_tag,
mw.maybe_cover_image_media_file_token,
count(*) as use_count
from generic_inference_jobs as gij
left outer join model_weights as mw
on gij.maybe_model_token = mw.token
where gij.created_at >= (CURDATE() - INTERVAL 5 DAY)
and (
mw.maybe_ietf_language_tag IS NULL
or mw.maybe_cover_image_media_file_token IS NULL
)
and mw.mod_deleted_at IS NULL
and mw.user_deleted_at IS NULL
and gij.maybe_creator_user_token NOT IN (
-- This subquery returns streamers that generated over a certain threshold number of results
select
user_token
from (
select
u.token as user_token,
count(*) as generations
from generic_inference_jobs as gij
join users as u
on gij.maybe_creator_user_token = u.token
where gij.created_at >= (CURDATE() - INTERVAL 5 DAY)
and gij.maybe_creator_user_token is not null
group by user_token
order by generations desc
) as top_users
where top_users.generations > 300
)
group by
mw.token,
mw.title,
mw.maybe_ietf_language_tag,
mw.maybe_cover_image_media_file_token
order by use_count desc
limit 50;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
DROP TABLE google_sign_in_accounts;
@@ -1,90 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
-- Google SSO / "Sign in with Google" data
-- Many of the values come from OpenID Connect:
-- https://developers.google.com/identity/openid-connect/openid-connect
CREATE TABLE google_sign_in_accounts(
-- Not used for anything except replication.
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
-- Effective "primary key" (PUBLIC)
token VARCHAR(32) NOT NULL,
-- An identifier for the user, unique among all Google accounts and never reused.
-- A Google account can have multiple email addresses at different points in time, but the sub
-- value is never changed. Use sub within your application as the unique-identifier key for the
-- user. Maximum length of 255 case-sensitive ASCII characters.
--
-- https://developers.google.com/identity/openid-connect/openid-connect#an-id-tokens-payload
--
-- Subject Identifier. A locally unique and never reassigned identifier within
-- the Issuer for the End-User, which is intended to be consumed by the Client, e.g., 24400320
-- or AItOawmwtWwcT0k51BayewNvutrJUqsvl6qs7A4. It MUST NOT exceed 255 ASCII characters in
-- length. The sub value is a case sensitive string."
--
-- https://stackoverflow.com/a/72091170
-- https://stackoverflow.com/a/74003331
--
subject VARCHAR(255) NOT NULL,
-- ========== FOREIGN KEYS ==========
-- Foreign key link to the users table record.
-- This could be removed later if a user disassociates their account.
maybe_user_token VARCHAR(32) DEFAULT NULL,
-- ========== OTHER INFO ==========
-- The user's email address. Provided only if you included the email scope in your request.
-- The value of this claim may not be unique to this account and could change over time,
-- therefore you should not use this value as the primary identifier to link to your user record.
-- You also can't rely on the domain of the email claim to identify users of Google Workspace or
-- Cloud organizations; use the hd claim instead.
--
-- NB: If this is null, we'll simply deny the sign in / sign up event. So effectively, our copy
-- will never be null.
email_address VARCHAR(255) NOT NULL,
-- True if the user's e-mail address has been verified; otherwise false.
is_email_verified BOOLEAN NOT NULL DEFAULT false,
-- The user's locale, represented by a BCP 47 language tag.
-- Might be provided when a name claim is present.
maybe_locale VARCHAR(255) DEFAULT NULL,
-- The user's full name, in a displayable form. Might be provided when: [...]
maybe_name VARCHAR(255) DEFAULT NULL,
-- The user's given name(s) or first name(s). Might be provided when a name claim is present.
maybe_given_name VARCHAR(255) DEFAULT NULL,
-- The user's surname(s) or last name(s). Might be provided when a name claim is present.
maybe_family_name VARCHAR(255) DEFAULT NULL,
-- For abuse tracking.
-- Wide enough for IPv4/6
ip_address_creation VARCHAR(40) NOT NULL,
ip_address_update VARCHAR(40) NOT NULL,
-- ========== VECTOR CLOCK ==========
-- Incremented with every update.
version INT NOT NULL DEFAULT 0,
-- ========== TIMESTAMPS ==========
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),
UNIQUE KEY (subject),
KEY index_maybe_user_token (maybe_user_token),
KEY index_email_address (email_address),
KEY index_created_at (created_at),
KEY index_updated_at (updated_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE users DROP COLUMN email_confirmed_by_google;
@@ -1,8 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE users
ADD COLUMN
email_confirmed_by_google BOOLEAN NOT NULL DEFAULT false
AFTER email_confirmed;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE users DROP COLUMN is_without_password;
@@ -1,8 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE users
ADD COLUMN
is_without_password BOOLEAN NOT NULL DEFAULT false
AFTER password_version;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE users DROP COLUMN maybe_signup_method;
@@ -1,8 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE users
ADD COLUMN
maybe_signup_method VARCHAR(32) DEFAULT NULL
AFTER maybe_source;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE users DROP COLUMN username_is_generated;
@@ -1,8 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE users
ADD COLUMN
username_is_generated BOOLEAN NOT NULL DEFAULT false
AFTER display_name;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE users DROP COLUMN username_is_not_customized;
@@ -1,8 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE users
ADD COLUMN
username_is_not_customized BOOLEAN NOT NULL DEFAULT false
AFTER username_is_generated;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE model_weights DROP COLUMN maybe_ietf_language_tag;
@@ -1,9 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE model_weights
ADD COLUMN
maybe_ietf_language_tag VARCHAR(64) DEFAULT NULL
AFTER maybe_description_rendered_html;
@@ -1,5 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE model_weights DROP COLUMN maybe_ietf_primary_language_subtag;
@@ -1,9 +0,0 @@
-- noinspection SqlDialectInspectionForFile
-- noinspection SqlNoDataSourceInspectionForFile
-- noinspection SqlResolveForFile
ALTER TABLE model_weights
ADD COLUMN
maybe_ietf_primary_language_subtag VARCHAR(12) DEFAULT NULL
AFTER maybe_ietf_language_tag;
@@ -53,22 +53,6 @@ CREATE TABLE model_weights (
-- models don't deserve a description).
maybe_description_rendered_html TEXT DEFAULT NULL,
-- OPTIONAL. Only for TTS and Voice Conversion models.
-- The full IETF BCP47 language tag (eg. en, en-US, es-419, ja-JP, pt, etc.)
-- (Not that it matters apart from categorization, since voice conversion is universal.)
-- NB: There's another set of tables (model_weights_extension_voice_conversion_details, etc.) that
-- may have older post-migration data for some models. We'll want to backfill this field from there
-- and then make this one authoritative.
maybe_ietf_language_tag VARCHAR(64) DEFAULT NULL,
-- OPTIONAL. Only for TTS and Voice Conversion models.
-- The IETF BCP47 language tag's primary language subtag (eg. "es-419" becomes "es")
-- (Not that it matters apart from categorization, since voice conversion is universal.)
-- NB: There's another set of tables (model_weights_extension_voice_conversion_details, etc.) that
-- may have older post-migration data for some models. We'll want to backfill this field from there
-- and then make this one authoritative.
maybe_ietf_primary_language_subtag VARCHAR(12) DEFAULT NULL,
-- ========== CREATOR DETAILS ==========
+1 -29
View File
@@ -16,29 +16,9 @@ CREATE TABLE users (
username VARCHAR(20) NOT NULL,
display_name VARCHAR(20) NOT NULL,
-- If the username the user currently has was automatically generated by our
-- system rather than manually entered. If the user selects the username we
-- made for them, we still leave this as true.
username_is_generated BOOLEAN NOT NULL DEFAULT false,
-- Users with new randomly generated usernames have this flag set to true.
-- If a user then changes their username from the default, we set this to false.
-- Or if a user elects that the random username we generated for them is fine,
-- we also set this to false.
username_is_not_customized BOOLEAN NOT NULL DEFAULT false,
-- Set by the user at sign up:
-- - When email + password signup, this is the email provided.
-- - When Google SSO, this is the email provided by Google.
email_address VARCHAR(255) NOT NULL,
-- Email address is confirmed by us.
-- We do not set this on 3rd party (ie. Google) "email confirmation", only our own.
email_confirmed BOOLEAN NOT NULL DEFAULT false,
-- Email address is confirmed by Google.
email_confirmed_by_google BOOLEAN NOT NULL DEFAULT false,
-- The role assigned to the user confers permissions.
user_role_slug VARCHAR(16) NOT NULL,
@@ -85,9 +65,6 @@ CREATE TABLE users (
-- Incremented with every update to the password.
password_version INT UNSIGNED NOT NULL DEFAULT 0,
-- Users signing up from SSO do not have a password at time of account creation.
is_without_password BOOLEAN NOT NULL DEFAULT false,
-- ========== ABUSE TRACKING ==========
-- For abuse tracking.
@@ -185,16 +162,11 @@ CREATE TABLE users (
-- ========== TRACKING ==========
-- Where the user signed up from (NOT NECESSARILY AN ENUM!)
-- Where the user signed up from
-- For now this will be "fakeyou" and "storyteller", but we may extend
-- or overload this to handle other cases or metadata.
maybe_source VARCHAR(255) DEFAULT NULL,
-- How users created their account
-- Initially this will be "email_password" or "google_sign_in"
-- Older users do not have a value and are assumed to be "email_sign_in"
maybe_signup_method VARCHAR(16) DEFAULT NULL,
-- ========== MODERATION DETAILS ==========
-- Different than deleted.
@@ -1,5 +1,5 @@
[package]
name = "bucket_paths"
name = "buckets"
edition = "2018"
version = "0.0.1"
authors = [
@@ -9,21 +9,24 @@ authors = [
publish = false
[lib]
name = "bucket_paths"
name = "buckets"
path = "src/lib.rs"
[package.metadata.cargo-udeps.ignore]
normal = ["my-workspace-hack"]
[dependencies]
# Internal
crockford = { path = "../../lib/data/crockford" }
#errors = { path = "../../lib/errors" }
# Workspace hack (faster compile times)
my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
# Internal
crockford = { path = "../data/crockford" }
# External
# (None yet)
# (none yet)
[dev-dependencies]
# None yet
# (none yet)
+25
View File
@@ -0,0 +1,25 @@
//! buckets
//!
//! The purpose of this library is to maintain strongly typed cloud storage buckets
//! that can be shared between projects.
//!
// Never allow these
#![forbid(private_bounds)]
#![forbid(private_interfaces)]
#![forbid(unused_must_use)] // NB: It's unsafe to not close/check some things
// Okay to toggle
#![forbid(unreachable_patterns)]
// #![forbid(unused_imports)]
#![forbid(unused_mut)]
#![forbid(unused_variables)]
// Always allow
#![allow(dead_code)]
#![allow(non_snake_case)]
pub mod util;
pub mod private;
pub mod public;
@@ -1,6 +1,6 @@
use crockford::crockford_entropy_lower;
use crate::legacy::typified_paths::private::private_path::PrivatePath;
use crate::private::private_path::PrivatePath;
use crate::util::hashed_directory_path_long_string::hashed_directory_path_long_string;
// TODO: Generate these from a macro.
@@ -81,7 +81,7 @@ impl ZeroShotVoiceEmbeddingBucketDirectory {
#[cfg(test)]
mod tests {
use crate::legacy::typified_paths::private::zs_voices::bucket_directory::{ModelCategory, ModelType, ZeroShotVoiceEmbeddingBucketDirectory};
use crate::private::zs_voices::bucket_directory::{ModelCategory, ModelType, ZeroShotVoiceEmbeddingBucketDirectory};
#[test]
pub fn generate_new_entropy() {
@@ -2,8 +2,8 @@ use std::path::PathBuf;
use crockford::crockford_entropy_lower;
use crate::legacy::typified_paths::private::private_path::PrivatePath;
use crate::legacy::typified_paths::private::zs_voices::bucket_directory::{ModelCategory, ModelType, ZeroShotVoiceEmbeddingBucketDirectory};
use crate::private::private_path::PrivatePath;
use crate::private::zs_voices::bucket_directory::{ModelCategory, ModelType, ZeroShotVoiceEmbeddingBucketDirectory};
// TODO: Generate these from a macro.
@@ -74,8 +74,8 @@ mod tests {
use std::path::PathBuf;
mod with_prefix_and_extension {
use crate::legacy::typified_paths::private::zs_voices::bucket_directory::ModelCategory;
use crate::legacy::typified_paths::private::zs_voices::bucket_file_path::{ModelType, ZeroShotVoiceEmbeddingBucketPath};
use crate::private::zs_voices::bucket_directory::ModelCategory;
use crate::private::zs_voices::bucket_file_path::{ModelType, ZeroShotVoiceEmbeddingBucketPath};
#[test]
pub fn generate_new_entropy() {
@@ -94,8 +94,8 @@ mod tests {
}
mod without_prefix_and_extension {
use crate::legacy::typified_paths::private::zs_voices::bucket_directory::ModelCategory;
use crate::legacy::typified_paths::private::zs_voices::bucket_file_path::{ModelType, ZeroShotVoiceEmbeddingBucketPath};
use crate::private::zs_voices::bucket_directory::ModelCategory;
use crate::private::zs_voices::bucket_file_path::{ModelType, ZeroShotVoiceEmbeddingBucketPath};
use super::*;
@@ -1,6 +1,6 @@
use crockford::crockford_entropy_lower;
use crate::legacy::typified_paths::public::public_path::PublicPath;
use crate::public::public_path::PublicPath;
use crate::util::hashed_directory_path_long_string::hashed_directory_path_long_string;
// TODO: Generate these from a macro.
@@ -10,7 +10,7 @@ const MEDIA_FILE_DIRECTORY: &str = "/media";
/// Directory for user media uploads.
/// Each uploaded file gets its own directory so that we can store the original
/// file alongside re-processed derivatives.
#[derive(Clone, Debug)]
#[derive(Clone)]
pub struct MediaFileBucketDirectory {
object_hash: String,
directory: String,
@@ -46,7 +46,7 @@ impl MediaFileBucketDirectory {
#[cfg(test)]
mod tests {
use crate::legacy::typified_paths::public::media_files::bucket_directory::MediaFileBucketDirectory;
use crate::public::media_files::bucket_directory::MediaFileBucketDirectory;
#[test]
pub fn generate_new_entropy() {
@@ -2,8 +2,8 @@ use std::path::PathBuf;
use crockford::crockford_entropy_lower;
use crate::legacy::typified_paths::public::media_files::bucket_directory::MediaFileBucketDirectory;
use crate::legacy::typified_paths::public::public_path::PublicPath;
use crate::public::media_files::bucket_directory::MediaFileBucketDirectory;
use crate::public::public_path::PublicPath;
const ORIGINAL_FILE_BASENAME : &str = "file.bin";
@@ -87,7 +87,7 @@ impl MediaFileBucketPath {
mod tests {
use std::path::PathBuf;
use crate::legacy::typified_paths::public::media_files::bucket_file_path::MediaFileBucketPath;
use crate::public::media_files::bucket_file_path::MediaFileBucketPath;
mod with_prefix_and_extension {
use super::*;
@@ -1,6 +1,6 @@
use crockford::crockford_entropy_lower;
use crate::legacy::typified_paths::public::public_path::PublicPath;
use crate::public::public_path::PublicPath;
use crate::util::hashed_directory_path_long_string::hashed_directory_path_long_string;
// TODO: Generate these from a macro.
@@ -47,7 +47,7 @@ impl MediaUploadDirectory {
#[cfg(test)]
mod tests {
use crate::legacy::typified_paths::public::media_uploads::bucket_directory::MediaUploadDirectory;
use crate::public::media_uploads::bucket_directory::MediaUploadDirectory;
#[test]
pub fn generate_new_entropy() {
@@ -2,8 +2,8 @@ use std::path::PathBuf;
use crockford::crockford_entropy_lower;
use crate::legacy::typified_paths::public::media_uploads::bucket_directory::MediaUploadDirectory;
use crate::legacy::typified_paths::public::public_path::PublicPath;
use crate::public::media_uploads::bucket_directory::MediaUploadDirectory;
use crate::public::public_path::PublicPath;
const ORIGINAL_FILE_BASENAME : &str = "original_upload.bin";
@@ -69,7 +69,7 @@ impl MediaUploadOriginalFilePath {
mod tests {
use std::path::PathBuf;
use crate::legacy::typified_paths::public::media_uploads::bucket_file_path::MediaUploadOriginalFilePath;
use crate::public::media_uploads::bucket_file_path::MediaUploadOriginalFilePath;
#[test]
pub fn generate_new_entropy() {
@@ -1,4 +1,4 @@
use crate::legacy::typified_paths::public::public_path::PublicPath;
use crate::public::public_path::PublicPath;
use crate::util::hashed_directory_path_long_string::hashed_directory_path_long_string;
// TODO: Generate these from a macro.
@@ -40,7 +40,7 @@ impl VoiceConversionResultDirectory {
#[cfg(test)]
mod tests {
use crate::legacy::typified_paths::public::voice_conversion_results::bucket_directory::VoiceConversionResultDirectory;
use crate::public::voice_conversion_results::bucket_directory::VoiceConversionResultDirectory;
#[test]
pub fn get_directory_path_str() {
@@ -2,8 +2,8 @@ use std::path::PathBuf;
use crockford::crockford_entropy_lower;
use crate::legacy::typified_paths::public::public_path::PublicPath;
use crate::legacy::typified_paths::public::voice_conversion_results::bucket_directory::VoiceConversionResultDirectory;
use crate::public::public_path::PublicPath;
use crate::public::voice_conversion_results::bucket_directory::VoiceConversionResultDirectory;
const ORIGINAL_FILE_PREFIX : &str = "fakeyou_";
const ORIGINAL_FILE_SUFFIX : &str = ".wav";
@@ -65,7 +65,7 @@ impl VoiceConversionResultOriginalFilePath {
mod tests {
use std::path::PathBuf;
use crate::legacy::typified_paths::public::voice_conversion_results::bucket_file_path::VoiceConversionResultOriginalFilePath;
use crate::public::voice_conversion_results::bucket_file_path::VoiceConversionResultOriginalFilePath;
#[test]
pub fn generate_new_entropy() {
@@ -1,6 +1,6 @@
use crockford::crockford_entropy_lower;
use crate::legacy::typified_paths::public::public_path::PublicPath;
use crate::public::public_path::PublicPath;
use crate::util::hashed_directory_path_long_string::hashed_directory_path_long_string;
// TODO: Generate these from a macro.
@@ -46,7 +46,7 @@ impl WeightFileBucketDirectory {
#[cfg(test)]
mod tests {
use crate::legacy::typified_paths::public::weight_files::bucket_directory::WeightFileBucketDirectory;
use crate::public::weight_files::bucket_directory::WeightFileBucketDirectory;
#[test]
pub fn generate_new_entropy() {
@@ -1,13 +1,12 @@
use std::path::PathBuf;
use crockford::crockford_entropy_lower;
use crate::legacy::typified_paths::public::public_path::PublicPath;
use crate::public::public_path::PublicPath;
const ORIGINAL_FILE_BASENAME : &str = "file.bin";
// TODO: Generate these from a macro.
use crate::legacy::typified_paths::public::weight_files::bucket_directory::WeightFileBucketDirectory;
use crate::public::weight_files::bucket_directory::WeightFileBucketDirectory;
/// The original user upload file.
/// It may have derivative files (down samples, crops, etc.) that live alongside it.
#[derive(Clone)]
@@ -121,7 +120,7 @@ impl WeightFileBucketPath {
mod tests {
use std::path::PathBuf;
use crate::legacy::typified_paths::public::weight_files::bucket_file_path::WeightFileBucketPath;
use crate::public::weight_files::bucket_file_path::WeightFileBucketPath;
mod with_prefix_and_extension {
use super::*;
@@ -4,7 +4,7 @@ use crockford::crockford_entropy_lower;
// essentially, the only difference is the prefix and file postfix and the path of where the file goes and the path will be constructed from there.
// then you can tie in the downloader as a single object that can be used for both public and private buckets.
use crate::legacy::typified_paths::public::public_path::PublicPath;
use crate::public::public_path::PublicPath;
use crate::util::hashed_directory_path_long_string::hashed_directory_path_long_string;
const WEIGHT_UPLOAD_DIRECTORY : &str = "/weight_upload";
@@ -48,7 +48,7 @@ impl WeightUploadDirectory {
#[cfg(test)]
mod tests {
use crate::legacy::typified_paths::public::weight_uploads::bucket_directory::WeightUploadDirectory;
use crate::public::weight_uploads::bucket_directory::WeightUploadDirectory;
#[test]
pub fn generate_new_entropy() {
@@ -2,8 +2,8 @@ use std::path::PathBuf;
use crockford::crockford_entropy_lower;
use crate::legacy::typified_paths::public::public_path::PublicPath;
use crate::legacy::typified_paths::public::weight_uploads::bucket_directory::WeightUploadDirectory;
use crate::public::public_path::PublicPath;
use crate::public::weight_uploads::bucket_directory::WeightUploadDirectory;
const ORIGINAL_FILE_BASENAME : &str = "original_upload.bin";
@@ -57,7 +57,7 @@ impl WeightUploadOriginalFilePath {
mod tests {
use std::path::PathBuf;
use crate::legacy::typified_paths::public::weight_uploads::bucket_file_path::WeightUploadOriginalFilePath;
use crate::public::weight_uploads::bucket_file_path::WeightUploadOriginalFilePath;
#[test]
pub fn generate_new_entropy() {
@@ -5,7 +5,7 @@
/// With a million items, each directory will have ~1 item.
/// With a billion items, each directory will have ~953 items (totally tractable).
///
pub (crate) fn hashed_directory_path_long_string(file_hash: &str) -> String {
pub fn hashed_directory_path_long_string(file_hash: &str) -> String {
match file_hash.len() {
0 | 1 => "".to_string(),
2 => format!("{}/", &file_hash[0..1]),
@@ -17,7 +17,7 @@ pub fn hashed_directory_path_short_string(file_hash: &str) -> String {
#[cfg(test)]
mod tests {
use crate::legacy::old_bespoke_paths::hashed_directory_path_short_string::hashed_directory_path_short_string;
use crate::util::hashed_directory_path_short_string::hashed_directory_path_short_string;
#[test]
fn test_length_zero() {
+2
View File
@@ -0,0 +1,2 @@
pub mod hashed_directory_path_long_string;
pub mod hashed_directory_path_short_string;
@@ -27,9 +27,9 @@ my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
serde = "1.0.125"
serde_derive = "1.0.125"
sqlx = { version = "0.7.2", features = [ "mysql", "sqlite", "runtime-tokio-native-tls", "chrono" ] }
sqlx-core = { version = "0.7.2" }
sqlx-mysql= { version = "0.7.2" }
sqlx = { version = "0.8.2", features = [ "mysql", "sqlite", "runtime-tokio-native-tls", "chrono" ] }
sqlx-core = { version = "0.8.2" }
sqlx-mysql= { version = "0.8.2" }
utoipa = { version = "4", features = ["chrono","actix_extras"] }
@@ -1,4 +1,3 @@
pub mod audit_logs;
pub mod batch_generations;
pub mod featured_items;
pub mod tag_uses;
@@ -1 +0,0 @@
pub mod tag_use_entity;
@@ -1,40 +0,0 @@
use enums::by_table::tag_uses::tag_use_entity_type::TagUseEntityType;
use tokens::tokens::media_files::MediaFileToken;
use tokens::tokens::model_weights::ModelWeightToken;
// TODO(bt, 2024-01-16): A ref type with <'a> lifetime of inner data instead of ownership?
pub enum TagUseEntity {
MediaFile(MediaFileToken),
ModelWeight(ModelWeightToken),
}
// TODO(bt, 2024-01-16): Codegen? Make traits for these? Maybe overkill.
impl TagUseEntity {
pub fn from_entity_type_and_token(entity_type: TagUseEntityType, token: &str) -> Self {
match entity_type {
TagUseEntityType::ModelWeight => Self::ModelWeight(ModelWeightToken::new_from_str(token)),
TagUseEntityType::MediaFile => Self::MediaFile(MediaFileToken::new_from_str(token)),
}
}
pub fn get_entity_type(&self) -> TagUseEntityType {
match self {
Self::MediaFile(_) => TagUseEntityType::MediaFile,
Self::ModelWeight(_) => TagUseEntityType::ModelWeight,
}
}
pub fn get_entity_token_str(&self) -> &str {
match self {
Self::MediaFile(token) => token.as_str(),
Self::ModelWeight(token) => token.as_str(),
}
}
pub fn get_composite_keys(&self) -> (TagUseEntityType, &str) {
match self {
Self::MediaFile(token) => (TagUseEntityType::MediaFile, token.as_str()),
Self::ModelWeight(token) => (TagUseEntityType::ModelWeight, token.as_str()),
}
}
}
+7 -3
View File
@@ -25,9 +25,9 @@ my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
serde = "1.0.125"
serde_derive = "1.0.125"
sqlx = { version = "0.7.2", features = [ "mysql", "sqlite", "runtime-tokio-native-tls", "chrono" ] }
sqlx-core = { version = "0.7.2" }
sqlx-mysql= { version = "0.7.2" }
sqlx = { version = "0.8.2", features = [ "mysql", "sqlite", "runtime-tokio-native-tls", "chrono" ] }
sqlx-core = { version = "0.8.2" }
sqlx-mysql= { version = "0.8.2" }
utoipa = { version = "4", features = ["chrono","actix_extras"] }
@@ -39,3 +39,7 @@ strum = { version = "0.26", features = ["derive"] }
# Test serialization
serde_json = "1.0.108"
toml = "0.8.14"
# Temporary for a test
errors = { path = "../../lib/errors" }
chrono = { version = "0.4.22", features = ["serde"] }
@@ -57,9 +57,6 @@ pub enum InferenceCategory {
#[serde(rename = "live_portrait")]
LivePortrait,
#[serde(rename="seed_vc")]
SeedVc,
/// DEPRECATED. Do not use.
/// This was for ReRenderAVideo, which we never productionized.
#[deprecated(note = "This was for ReRenderAVideo, which we never productionized.")]
@@ -70,9 +67,6 @@ pub enum InferenceCategory {
#[deprecated(note = "This was for Bevy engine's server side rendering.")]
#[serde(rename = "convert_bvh_to_workflow")]
ConvertBvhToWorkflow,
#[serde(rename = "f5_tts")]
F5TTS,
}
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
@@ -91,10 +85,8 @@ impl InferenceCategory {
Self::ImageGeneration => "image_generation",
Self::Mocap => "mocap",
Self::Workflow => "workflow",
Self::F5TTS => "f5_tts",
Self::FormatConversion => "format_conversion",
Self::LivePortrait => "live_portrait",
Self::SeedVc => "seed_vc",
Self::VideoFilter => "video_filter",
Self::ConvertBvhToWorkflow => "convert_bvh_to_workflow",
}
@@ -107,12 +99,10 @@ impl InferenceCategory {
"text_to_speech" => Ok(Self::TextToSpeech),
"voice_conversion" => Ok(Self::VoiceConversion),
"image_generation" => Ok(Self::ImageGeneration),
"f5_tts" => Ok(Self::F5TTS),
"mocap" => Ok(Self::Mocap),
"workflow" => Ok(Self::Workflow),
"format_conversion" => Ok(Self::FormatConversion),
"live_portrait" => Ok(Self::LivePortrait),
"seed_vc" => Ok(Self::SeedVc),
"video_filter" => Ok(Self::VideoFilter),
"convert_bvh_to_workflow" => Ok(Self::ConvertBvhToWorkflow),
_ => Err(format!("invalid value: {:?}", value)),
@@ -129,8 +119,6 @@ impl InferenceCategory {
Self::VoiceConversion,
Self::ImageGeneration,
Self::Mocap,
Self::F5TTS,
Self::SeedVc,
Self::Workflow,
Self::FormatConversion,
Self::LivePortrait,
@@ -156,8 +144,6 @@ mod tests {
assert_serialization(InferenceCategory::VoiceConversion, "voice_conversion");
assert_serialization(InferenceCategory::ImageGeneration, "image_generation");
assert_serialization(InferenceCategory::Mocap, "mocap");
assert_serialization(InferenceCategory::F5TTS, "f5_tts");
assert_serialization(InferenceCategory::SeedVc, "seed_vc");
assert_serialization(InferenceCategory::Workflow, "workflow");
assert_serialization(InferenceCategory::FormatConversion, "format_conversion");
assert_serialization(InferenceCategory::LivePortrait, "live_portrait");
@@ -172,8 +158,6 @@ mod tests {
assert_eq!(InferenceCategory::TextToSpeech.to_str(), "text_to_speech");
assert_eq!(InferenceCategory::VoiceConversion.to_str(), "voice_conversion");
assert_eq!(InferenceCategory::ImageGeneration.to_str(), "image_generation");
assert_eq!(InferenceCategory::F5TTS.to_str(), "f5_tts");
assert_eq!(InferenceCategory::SeedVc.to_str(), "seed_vc");
assert_eq!(InferenceCategory::Mocap.to_str(), "mocap");
assert_eq!(InferenceCategory::Workflow.to_str(), "workflow");
assert_eq!(InferenceCategory::FormatConversion.to_str(), "format_conversion");
@@ -189,8 +173,6 @@ mod tests {
assert_eq!(InferenceCategory::from_str("text_to_speech").unwrap(), InferenceCategory::TextToSpeech);
assert_eq!(InferenceCategory::from_str("voice_conversion").unwrap(), InferenceCategory::VoiceConversion);
assert_eq!(InferenceCategory::from_str("image_generation").unwrap(), InferenceCategory::ImageGeneration);
assert_eq!(InferenceCategory::from_str("f5_tts").unwrap(), InferenceCategory::F5TTS);
assert_eq!(InferenceCategory::from_str("seed_vc").unwrap(), InferenceCategory::SeedVc);
assert_eq!(InferenceCategory::from_str("mocap").unwrap(), InferenceCategory::Mocap);
assert_eq!(InferenceCategory::from_str("workflow").unwrap(), InferenceCategory::Workflow);
assert_eq!(InferenceCategory::from_str("format_conversion").unwrap(), InferenceCategory::FormatConversion);
@@ -203,15 +185,13 @@ mod tests {
fn all_variants() {
// Static check
let mut variants = InferenceCategory::all_variants();
assert_eq!(variants.len(), 12);
assert_eq!(variants.len(), 11);
assert_eq!(variants.pop_first(), Some(InferenceCategory::DeprecatedField));
assert_eq!(variants.pop_first(), Some(InferenceCategory::LipsyncAnimation));
assert_eq!(variants.pop_first(), Some(InferenceCategory::TextToSpeech));
assert_eq!(variants.pop_first(), Some(InferenceCategory::VoiceConversion));
assert_eq!(variants.pop_first(), Some(InferenceCategory::ImageGeneration));
assert_eq!(variants.pop_first(), Some(InferenceCategory::F5TTS));
assert_eq!(variants.pop_first(), Some(InferenceCategory::Mocap));
assert_eq!(variants.pop_first(), Some(InferenceCategory::SeedVc));
assert_eq!(variants.pop_first(), Some(InferenceCategory::Workflow));
assert_eq!(variants.pop_first(), Some(InferenceCategory::FormatConversion));
assert_eq!(variants.pop_first(), Some(InferenceCategory::LivePortrait));
@@ -27,9 +27,6 @@ pub enum InferenceJobProductCategory {
/// TTS: GptSoVits
TtsGptSoVits,
/// TTS: F5Tts (Zero Shot)
TtsF5,
/// TTS: StyleTts2 (Zero Shot)
TtsStyleTts2,
@@ -44,8 +41,6 @@ pub enum InferenceJobProductCategory {
/// Voice Conversion: SoVitsSvc
VcSvc,
VcSeedVc, // Ugh
// =============== VIDEO ===============
/// Video: Face Fusion (Lipsync)
@@ -63,9 +58,6 @@ pub enum InferenceJobProductCategory {
/// Video: Studio
VidStudio,
/// Video: Studio Gen 2
VidStudioGen2,
/// Video: Style Transfer
VidStyleTransfer,
@@ -116,16 +108,13 @@ impl InferenceJobProductCategory {
Self::TtsGptSoVits => "tts_gpt_so_vits",
Self::TtsStyleTts2 => "tts_style_tts2",
Self::TtsTacotron2 => "tts_tacotron2",
Self::TtsF5 => "tts_f5",
Self::VcSvc => "vc_svc",
Self::VcRvc2 => "vc_rvc2",
Self::VcSeedVc => "vc_seed_vc",
Self::VidLipsyncFaceFusion => "vid_lipsync_face_fusion",
Self::VidLipsyncSadTalker => "vid_lipsync_sad_talker",
Self::VidLivePortrait => "vid_live_portrait",
Self::VidLivePortraitWebcam => "vid_live_portrait_webcam",
Self::VidStudio => "vid_studio",
Self::VidStudioGen2 => "vid_studio_gen2",
Self::VidStyleTransfer => "vid_style_transfer",
Self::LipsyncFaceFusion => "lipsync_face_fusion",
Self::LipsyncSadTalker => "lipsync_sad_talker",
@@ -144,16 +133,13 @@ impl InferenceJobProductCategory {
"tts_gpt_so_vits" => Ok(Self::TtsGptSoVits),
"tts_style_tts2" => Ok(Self::TtsStyleTts2),
"tts_tacotron2" => Ok(Self::TtsTacotron2),
"tts_f5" => Ok(Self::TtsF5),
"vc_svc" => Ok(Self::VcSvc),
"vc_rvc2" => Ok(Self::VcRvc2),
"vc_seed_vc" => Ok(Self::VcSeedVc),
"vid_lipsync_face_fusion" => Ok(Self::VidLipsyncFaceFusion),
"vid_lipsync_sad_talker" => Ok(Self::VidLipsyncSadTalker),
"vid_live_portrait" => Ok(Self::VidLivePortrait),
"vid_live_portrait_webcam" => Ok(Self::VidLivePortraitWebcam),
"vid_studio" => Ok(Self::VidStudio),
"vid_studio_gen2" => Ok(Self::VidStudioGen2),
"vid_style_transfer" => Ok(Self::VidStyleTransfer),
"lipsync_face_fusion" => Ok(Self::LipsyncFaceFusion),
"lipsync_sad_talker" => Ok(Self::LipsyncSadTalker),
@@ -175,8 +161,6 @@ impl InferenceJobProductCategory {
Self::TtsGptSoVits,
Self::TtsStyleTts2,
Self::TtsTacotron2,
Self::TtsF5,
Self::VcSeedVc,
Self::VcSvc,
Self::VcRvc2,
Self::VidLipsyncFaceFusion,
@@ -184,7 +168,6 @@ impl InferenceJobProductCategory {
Self::VidLivePortrait,
Self::VidLivePortraitWebcam,
Self::VidStudio,
Self::VidStudioGen2,
Self::VidStyleTransfer,
Self::LipsyncFaceFusion,
Self::LipsyncSadTalker,
@@ -212,16 +195,13 @@ mod tests {
assert_serialization(InferenceJobProductCategory::TtsGptSoVits, "tts_gpt_so_vits");
assert_serialization(InferenceJobProductCategory::TtsStyleTts2, "tts_style_tts2");
assert_serialization(InferenceJobProductCategory::TtsTacotron2, "tts_tacotron2");
assert_serialization(InferenceJobProductCategory::TtsF5, "tts_f5");
assert_serialization(InferenceJobProductCategory::VcRvc2, "vc_rvc2");
assert_serialization(InferenceJobProductCategory::VcSvc, "vc_svc");
assert_serialization(InferenceJobProductCategory::VcSvc, "vc_svc");
assert_serialization(InferenceJobProductCategory::VidLipsyncFaceFusion, "vid_lipsync_face_fusion");
assert_serialization(InferenceJobProductCategory::VidLipsyncSadTalker, "vid_lipsync_sad_talker");
assert_serialization(InferenceJobProductCategory::VidLivePortrait, "vid_live_portrait");
assert_serialization(InferenceJobProductCategory::VidLivePortraitWebcam, "vid_live_portrait_webcam");
assert_serialization(InferenceJobProductCategory::VidStudio, "vid_studio");
assert_serialization(InferenceJobProductCategory::VidStudioGen2, "vid_studio_gen2");
assert_serialization(InferenceJobProductCategory::VidStyleTransfer, "vid_style_transfer");
assert_serialization(InferenceJobProductCategory::LipsyncFaceFusion, "lipsync_face_fusion");
assert_serialization(InferenceJobProductCategory::LipsyncSadTalker, "lipsync_sad_talker");
@@ -241,13 +221,11 @@ mod tests {
assert_eq!(InferenceJobProductCategory::TtsTacotron2.to_str(), "tts_tacotron2");
assert_eq!(InferenceJobProductCategory::VcRvc2.to_str(), "vc_rvc2");
assert_eq!(InferenceJobProductCategory::VcSvc.to_str(), "vc_svc");
assert_eq!(InferenceJobProductCategory::VcSvc.to_str(), "vc_svc");
assert_eq!(InferenceJobProductCategory::VidLipsyncFaceFusion.to_str(), "vid_lipsync_face_fusion");
assert_eq!(InferenceJobProductCategory::VidLipsyncSadTalker.to_str(), "vid_lipsync_sad_talker");
assert_eq!(InferenceJobProductCategory::VidLivePortrait.to_str(), "vid_live_portrait");
assert_eq!(InferenceJobProductCategory::VidLivePortraitWebcam.to_str(), "vid_live_portrait_webcam");
assert_eq!(InferenceJobProductCategory::VidStudio.to_str(), "vid_studio");
assert_eq!(InferenceJobProductCategory::VidStudioGen2.to_str(), "vid_studio_gen2");
assert_eq!(InferenceJobProductCategory::VidStyleTransfer.to_str(), "vid_style_transfer");
assert_eq!(InferenceJobProductCategory::LipsyncFaceFusion.to_str(), "lipsync_face_fusion");
assert_eq!(InferenceJobProductCategory::LipsyncSadTalker.to_str(), "lipsync_sad_talker");
@@ -267,13 +245,11 @@ mod tests {
assert_eq!(InferenceJobProductCategory::from_str("tts_tacotron2").unwrap(), InferenceJobProductCategory::TtsTacotron2);
assert_eq!(InferenceJobProductCategory::from_str("vc_rvc2").unwrap(), InferenceJobProductCategory::VcRvc2);
assert_eq!(InferenceJobProductCategory::from_str("vc_svc").unwrap(), InferenceJobProductCategory::VcSvc);
assert_eq!(InferenceJobProductCategory::from_str("vc_svc").unwrap(), InferenceJobProductCategory::VcSvc);
assert_eq!(InferenceJobProductCategory::from_str("vid_lipsync_face_fusion").unwrap(), InferenceJobProductCategory::VidLipsyncFaceFusion);
assert_eq!(InferenceJobProductCategory::from_str("vid_lipsync_sad_talker").unwrap(), InferenceJobProductCategory::VidLipsyncSadTalker);
assert_eq!(InferenceJobProductCategory::from_str("vid_live_portrait").unwrap(), InferenceJobProductCategory::VidLivePortrait);
assert_eq!(InferenceJobProductCategory::from_str("vid_live_portrait_webcam").unwrap(), InferenceJobProductCategory::VidLivePortraitWebcam);
assert_eq!(InferenceJobProductCategory::from_str("vid_studio").unwrap(), InferenceJobProductCategory::VidStudio);
assert_eq!(InferenceJobProductCategory::from_str("vid_studio_gen2").unwrap(), InferenceJobProductCategory::VidStudioGen2);
assert_eq!(InferenceJobProductCategory::from_str("vid_style_transfer").unwrap(), InferenceJobProductCategory::VidStyleTransfer);
assert_eq!(InferenceJobProductCategory::from_str("lipsync_face_fusion").unwrap(), InferenceJobProductCategory::LipsyncFaceFusion);
assert_eq!(InferenceJobProductCategory::from_str("lipsync_sad_talker").unwrap(), InferenceJobProductCategory::LipsyncSadTalker);
@@ -289,20 +265,18 @@ mod tests {
fn all_variants() {
// Static check
let mut variants = InferenceJobProductCategory::all_variants();
assert_eq!(variants.len(), 21);
assert_eq!(variants.len(), 20);
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::DownloadGptSoVits));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::TtsGptSoVits));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::TtsStyleTts2));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::TtsTacotron2));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::VcRvc2));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::VcSeedVc));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::VcSvc));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::VidLipsyncFaceFusion));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::VidLipsyncSadTalker));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::VidLivePortrait));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::VidLivePortraitWebcam));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::VidStudio));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::VidStudioGen2));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::VidStyleTransfer));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::LipsyncFaceFusion));
assert_eq!(variants.pop_first(), Some(InferenceJobProductCategory::LipsyncSadTalker));
@@ -36,10 +36,6 @@ pub enum InferenceJobType {
#[deprecated(note = "Use VideoRender instead.")]
ComfyUi,
/// Second gen studio
#[serde(rename = "studio_gen2")]
StudioGen2,
/// A job that turns "FBX" game engine files into "GLTF" files (Bevy-compatible).
#[serde(rename = "convert_fbx_gltf")]
ConvertFbxToGltf,
@@ -47,10 +43,6 @@ pub enum InferenceJobType {
/// Process a video into BVH mocap animation data for game engines
MocapNet,
/// Jobs that run F5TTS
#[serde(rename = "f5_tts")]
F5TTS,
/// RVC is a voice conversion model. RVCv2 is the most popular such model currently.
#[serde(rename = "rvc_v2")]
RvcV2,
@@ -61,9 +53,6 @@ pub enum InferenceJobType {
/// so-vits-svc voice conversion. This predates RVCv2.
SoVitsSvc,
#[serde(rename = "seed_vc")]
SeedVc,
/// Stable diffusion image generation
StableDiffusion,
@@ -104,15 +93,12 @@ impl InferenceJobType {
Self::VideoRender => "video_render",
Self::LivePortrait => "live_portrait",
Self::FaceFusion => "face_fusion",
Self::F5TTS => "f5_tts",
Self::GptSovits => "gpt_sovits",
Self::ComfyUi => "comfy_ui",
Self::StudioGen2 => "studio_gen2",
Self::ConvertFbxToGltf => "convert_fbx_gltf",
Self::MocapNet => "mocap_net",
Self::RvcV2 => "rvc_v2",
Self::SadTalker => "sad_talker",
Self::SeedVc => "seed_vc",
Self::SoVitsSvc => "so_vits_svc",
Self::StableDiffusion => "stable_diffusion",
Self::StyleTTS2 => "styletts2",
@@ -128,15 +114,12 @@ impl InferenceJobType {
"video_render" => Ok(Self::VideoRender),
"live_portrait" => Ok(Self::LivePortrait),
"face_fusion" => Ok(Self::FaceFusion),
"f5_tts" => Ok(Self::F5TTS),
"gpt_sovits" => Ok(Self::GptSovits),
"comfy_ui" => Ok(Self::ComfyUi),
"studio_gen2" => Ok(Self::StudioGen2),
"convert_fbx_gltf" => Ok(Self::ConvertFbxToGltf),
"mocap_net" => Ok(Self::MocapNet),
"rvc_v2" => Ok(Self::RvcV2),
"sad_talker" => Ok(Self::SadTalker),
"seed_vc" => Ok(Self::SeedVc),
"so_vits_svc" => Ok(Self::SoVitsSvc),
"stable_diffusion" => Ok(Self::StableDiffusion),
"styletts2" => Ok(Self::StyleTTS2),
@@ -155,15 +138,12 @@ impl InferenceJobType {
Self::VideoRender,
Self::LivePortrait,
Self::FaceFusion,
Self::F5TTS,
Self::GptSovits,
Self::ComfyUi,
Self::StudioGen2,
Self::ConvertFbxToGltf,
Self::MocapNet,
Self::RvcV2,
Self::SadTalker,
Self::SeedVc,
Self::SoVitsSvc,
Self::StableDiffusion,
Self::StyleTTS2,
@@ -193,15 +173,12 @@ mod tests {
assert_serialization(InferenceJobType::VideoRender, "video_render");
assert_serialization(InferenceJobType::LivePortrait, "live_portrait");
assert_serialization(InferenceJobType::FaceFusion, "face_fusion");
assert_serialization(InferenceJobType::F5TTS, "f5_tts");
assert_serialization(InferenceJobType::GptSovits, "gpt_sovits");
assert_serialization(InferenceJobType::ComfyUi, "comfy_ui");
assert_serialization(InferenceJobType::StudioGen2, "studio_gen2");
assert_serialization(InferenceJobType::ConvertFbxToGltf, "convert_fbx_gltf");
assert_serialization(InferenceJobType::MocapNet, "mocap_net");
assert_serialization(InferenceJobType::RvcV2, "rvc_v2");
assert_serialization(InferenceJobType::SadTalker, "sad_talker");
assert_serialization(InferenceJobType::SeedVc, "seed_vc");
assert_serialization(InferenceJobType::SoVitsSvc, "so_vits_svc");
assert_serialization(InferenceJobType::StableDiffusion, "stable_diffusion");
assert_serialization(InferenceJobType::StyleTTS2, "styletts2");
@@ -216,15 +193,12 @@ mod tests {
assert_eq!(InferenceJobType::VideoRender.to_str(), "video_render");
assert_eq!(InferenceJobType::LivePortrait.to_str(), "live_portrait");
assert_eq!(InferenceJobType::FaceFusion.to_str(), "face_fusion");
assert_eq!(InferenceJobType::F5TTS.to_str(), "f5_tts");
assert_eq!(InferenceJobType::GptSovits.to_str(), "gpt_sovits");
assert_eq!(InferenceJobType::ComfyUi.to_str(), "comfy_ui");
assert_eq!(InferenceJobType::StudioGen2.to_str(), "studio_gen2");
assert_eq!(InferenceJobType::ConvertFbxToGltf.to_str(), "convert_fbx_gltf");
assert_eq!(InferenceJobType::MocapNet.to_str(), "mocap_net");
assert_eq!(InferenceJobType::RvcV2.to_str(), "rvc_v2");
assert_eq!(InferenceJobType::SadTalker.to_str(), "sad_talker");
assert_eq!(InferenceJobType::SeedVc.to_str(), "seed_vc");
assert_eq!(InferenceJobType::SoVitsSvc.to_str(), "so_vits_svc");
assert_eq!(InferenceJobType::StableDiffusion.to_str(), "stable_diffusion");
assert_eq!(InferenceJobType::StyleTTS2.to_str(), "styletts2");
@@ -239,15 +213,12 @@ mod tests {
assert_eq!(InferenceJobType::from_str("video_render").unwrap(), InferenceJobType::VideoRender);
assert_eq!(InferenceJobType::from_str("live_portrait").unwrap(), InferenceJobType::LivePortrait);
assert_eq!(InferenceJobType::from_str("face_fusion").unwrap(), InferenceJobType::FaceFusion);
assert_eq!(InferenceJobType::from_str("f5_tts").unwrap(), InferenceJobType::F5TTS);
assert_eq!(InferenceJobType::from_str("gpt_sovits").unwrap(), InferenceJobType::GptSovits);
assert_eq!(InferenceJobType::from_str("comfy_ui").unwrap(), InferenceJobType::ComfyUi);
assert_eq!(InferenceJobType::from_str("studio_gen2").unwrap(), InferenceJobType::StudioGen2);
assert_eq!(InferenceJobType::from_str("convert_fbx_gltf").unwrap(), InferenceJobType::ConvertFbxToGltf);
assert_eq!(InferenceJobType::from_str("mocap_net").unwrap(), InferenceJobType::MocapNet);
assert_eq!(InferenceJobType::from_str("rvc_v2").unwrap(), InferenceJobType::RvcV2);
assert_eq!(InferenceJobType::from_str("sad_talker").unwrap(), InferenceJobType::SadTalker);
assert_eq!(InferenceJobType::from_str("seed_vc").unwrap(), InferenceJobType::SeedVc);
assert_eq!(InferenceJobType::from_str("so_vits_svc").unwrap(), InferenceJobType::SoVitsSvc);
assert_eq!(InferenceJobType::from_str("stable_diffusion").unwrap(), InferenceJobType::StableDiffusion);
assert_eq!(InferenceJobType::from_str("styletts2").unwrap(), InferenceJobType::StyleTTS2);
@@ -265,15 +236,12 @@ mod tests {
assert_eq!(variants.pop_first(), Some(InferenceJobType::VideoRender));
assert_eq!(variants.pop_first(), Some(InferenceJobType::LivePortrait));
assert_eq!(variants.pop_first(), Some(InferenceJobType::FaceFusion));
assert_eq!(variants.pop_first(), Some(InferenceJobType::F5TTS));
assert_eq!(variants.pop_first(), Some(InferenceJobType::GptSovits));
assert_eq!(variants.pop_first(), Some(InferenceJobType::ComfyUi));
assert_eq!(variants.pop_first(), Some(InferenceJobType::StudioGen2));
assert_eq!(variants.pop_first(), Some(InferenceJobType::ConvertFbxToGltf));
assert_eq!(variants.pop_first(), Some(InferenceJobType::MocapNet));
assert_eq!(variants.pop_first(), Some(InferenceJobType::RvcV2));
assert_eq!(variants.pop_first(), Some(InferenceJobType::SadTalker));
assert_eq!(variants.pop_first(), Some(InferenceJobType::SeedVc));
assert_eq!(variants.pop_first(), Some(InferenceJobType::SoVitsSvc));
assert_eq!(variants.pop_first(), Some(InferenceJobType::StableDiffusion));
assert_eq!(variants.pop_first(), Some(InferenceJobType::StyleTTS2));
@@ -29,10 +29,6 @@ pub enum InferenceModelType {
#[serde(rename = "so_vits_svc")]
SoVitsSvc,
// TODO: Does this need to be "legacy_tacotron2" ?
#[serde(rename = "seed_vc")]
SeedVc,
#[serde(rename = "tacotron2")]
Tacotron2,
#[serde(rename = "vits")]
@@ -70,7 +66,6 @@ impl InferenceModelType {
Self::VallEX => "vall_e_x",
Self::RerenderAVideo => "rerender_a_video",
Self::StableDiffusion => "stable_diffusion",
Self::SeedVc => "seed_vc",
Self::MocapNet => "mocap_net",
Self::StyleTTS2 => "styletts2",
Self::ComfyUi => "comfy_ui",
@@ -84,7 +79,6 @@ impl InferenceModelType {
"rvc_v2" => Ok(Self::RvcV2),
"sad_talker" => Ok(Self::SadTalker),
"so_vits_svc" => Ok(Self::SoVitsSvc),
"seed_vc" => Ok(Self::SeedVc),
"tacotron2" => Ok(Self::Tacotron2),
"vits" => Ok(Self::Vits),
"vall_e_x" => Ok(Self::VallEX),
@@ -103,11 +97,9 @@ impl InferenceModelType {
// NB: BTreeSet is sorted
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
BTreeSet::from([
Self::ComfyUi,
Self::RvcV2,
Self::SadTalker,
Self::SoVitsSvc,
Self::SeedVc,
Self::Tacotron2,
Self::Vits,
Self::VallEX,
@@ -115,8 +107,9 @@ impl InferenceModelType {
Self::StableDiffusion,
Self::MocapNet,
Self::StyleTTS2,
Self::ComfyUi,
Self::ConvertFbxToGltf,
Self::BvhToWorkflow,
Self::BvhToWorkflow,
])
}
}
@@ -133,7 +126,6 @@ mod tests {
fn test_serialization() {
assert_serialization(InferenceModelType::RvcV2, "rvc_v2");
assert_serialization(InferenceModelType::SadTalker, "sad_talker");
assert_serialization(InferenceModelType::SeedVc, "seed_vc");
assert_serialization(InferenceModelType::SoVitsSvc, "so_vits_svc");
assert_serialization(InferenceModelType::Tacotron2, "tacotron2");
assert_serialization(InferenceModelType::Vits, "vits");
@@ -149,11 +141,9 @@ mod tests {
#[test]
fn to_str() {
assert_eq!(InferenceModelType::ComfyUi.to_str(), "comfy_ui");
assert_eq!(InferenceModelType::RvcV2.to_str(), "rvc_v2");
assert_eq!(InferenceModelType::SadTalker.to_str(), "sad_talker");
assert_eq!(InferenceModelType::SoVitsSvc.to_str(), "so_vits_svc");
assert_eq!(InferenceModelType::SoVitsSvc.to_str(), "so_vits_svc");
assert_eq!(InferenceModelType::Tacotron2.to_str(), "tacotron2");
assert_eq!(InferenceModelType::Vits.to_str(), "vits");
assert_eq!(InferenceModelType::VallEX.to_str(), "vall_e_x");
@@ -161,6 +151,7 @@ mod tests {
assert_eq!(InferenceModelType::StableDiffusion.to_str(), "stable_diffusion");
assert_eq!(InferenceModelType::MocapNet.to_str(), "mocap_net");
assert_eq!(InferenceModelType::StyleTTS2.to_str(), "styletts2");
assert_eq!(InferenceModelType::ComfyUi.to_str(), "comfy_ui");
assert_eq!(InferenceModelType::ConvertFbxToGltf.to_str(), "convert_fbx_gltf");
assert_eq!(InferenceModelType::BvhToWorkflow.to_str(), "bvh_to_workflow");
}
@@ -169,7 +160,6 @@ mod tests {
fn from_str() {
assert_eq!(InferenceModelType::from_str("rvc_v2").unwrap(), InferenceModelType::RvcV2);
assert_eq!(InferenceModelType::from_str("sad_talker").unwrap(), InferenceModelType::SadTalker);
assert_eq!(InferenceModelType::from_str("seed_vc").unwrap(), InferenceModelType::SeedVc);
assert_eq!(InferenceModelType::from_str("so_vits_svc").unwrap(), InferenceModelType::SoVitsSvc);
assert_eq!(InferenceModelType::from_str("tacotron2").unwrap(), InferenceModelType::Tacotron2);
assert_eq!(InferenceModelType::from_str("vits").unwrap(), InferenceModelType::Vits);
@@ -188,10 +178,8 @@ mod tests {
// Static check
let mut variants = InferenceModelType::all_variants();
assert_eq!(variants.len(), 13);
assert_eq!(variants.pop_first(), Some(InferenceModelType::ComfyUi));
assert_eq!(variants.pop_first(), Some(InferenceModelType::RvcV2));
assert_eq!(variants.pop_first(), Some(InferenceModelType::SadTalker));
assert_eq!(variants.pop_first(), Some(InferenceModelType::SeedVc));
assert_eq!(variants.pop_first(), Some(InferenceModelType::SoVitsSvc));
assert_eq!(variants.pop_first(), Some(InferenceModelType::Tacotron2));
assert_eq!(variants.pop_first(), Some(InferenceModelType::Vits));
@@ -199,6 +187,7 @@ mod tests {
assert_eq!(variants.pop_first(), Some(InferenceModelType::RerenderAVideo));
assert_eq!(variants.pop_first(), Some(InferenceModelType::StableDiffusion));
assert_eq!(variants.pop_first(), Some(InferenceModelType::MocapNet));
assert_eq!(variants.pop_first(), Some(InferenceModelType::ComfyUi));
assert_eq!(variants.pop_first(), Some(InferenceModelType::StyleTTS2));
assert_eq!(variants.pop_first(), Some(InferenceModelType::ConvertFbxToGltf));
assert_eq!(variants.pop_first(), Some(InferenceModelType::BvhToWorkflow));
@@ -18,9 +18,6 @@ pub enum MediaFileOriginModelType {
#[serde(rename = "face_fusion")]
FaceFusion,
#[serde(rename = "f5_tts")]
F5TTS,
#[serde(rename = "live_portrait")]
LivePortrait,
@@ -42,9 +39,6 @@ pub enum MediaFileOriginModelType {
#[serde(rename = "mocap_net")]
MocapNet,
#[serde(rename = "seed_vc")]
SeedVc,
#[serde(rename = "styletts2")]
StyleTTS2,
@@ -83,11 +77,9 @@ impl MediaFileOriginModelType {
pub fn to_str(&self) -> &'static str {
match self {
Self::FaceFusion => "face_fusion",
Self::F5TTS => "f5_tts",
Self::LivePortrait => "live_portrait",
Self::RvcV2 => "rvc_v2",
Self::SadTalker => "sad_talker",
Self::SeedVc => "seed_vc",
Self::SoVitsSvc => "so_vits_svc",
Self::Tacotron2 => "tacotron2",
Self::MocapNet => "mocap_net",
@@ -105,11 +97,9 @@ impl MediaFileOriginModelType {
pub fn from_str(value: &str) -> Result<Self, String> {
match value {
"face_fusion" => Ok(Self::FaceFusion),
"f5_tts" => Ok(Self::F5TTS),
"live_portrait" => Ok(Self::LivePortrait),
"rvc_v2" => Ok(Self::RvcV2),
"sad_talker" => Ok(Self::SadTalker),
"seed_vc" => Ok(Self::SeedVc),
"so_vits_svc" => Ok(Self::SoVitsSvc),
"tacotron2" => Ok(Self::Tacotron2),
"mocap_net" => Ok(Self::MocapNet),
@@ -130,11 +120,9 @@ impl MediaFileOriginModelType {
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
BTreeSet::from([
Self::FaceFusion,
Self::F5TTS,
Self::LivePortrait,
Self::RvcV2,
Self::SadTalker,
Self::SeedVc,
Self::SoVitsSvc,
Self::Tacotron2,
Self::MocapNet,
@@ -167,11 +155,9 @@ mod tests {
#[test]
fn test_to_str() {
assert_eq!(MediaFileOriginModelType::FaceFusion.to_str(), "face_fusion");
assert_eq!(MediaFileOriginModelType::F5TTS.to_str(), "f5_tts");
assert_eq!(MediaFileOriginModelType::LivePortrait.to_str(), "live_portrait");
assert_eq!(MediaFileOriginModelType::RvcV2.to_str(), "rvc_v2");
assert_eq!(MediaFileOriginModelType::SadTalker.to_str(), "sad_talker");
assert_eq!(MediaFileOriginModelType::SeedVc.to_str(), "seed_vc");
assert_eq!(MediaFileOriginModelType::SoVitsSvc.to_str(), "so_vits_svc");
assert_eq!(MediaFileOriginModelType::Tacotron2.to_str(), "tacotron2");
assert_eq!(MediaFileOriginModelType::MocapNet.to_str(), "mocap_net");
@@ -188,11 +174,9 @@ mod tests {
#[test]
fn test_from_str() {
assert_eq!(MediaFileOriginModelType::from_str("face_fusion").unwrap(), MediaFileOriginModelType::FaceFusion);
assert_eq!(MediaFileOriginModelType::from_str("f5_tts").unwrap(), MediaFileOriginModelType::F5TTS);
assert_eq!(MediaFileOriginModelType::from_str("live_portrait").unwrap(), MediaFileOriginModelType::LivePortrait);
assert_eq!(MediaFileOriginModelType::from_str("rvc_v2").unwrap(), MediaFileOriginModelType::RvcV2);
assert_eq!(MediaFileOriginModelType::from_str("sad_talker").unwrap(), MediaFileOriginModelType::SadTalker);
assert_eq!(MediaFileOriginModelType::from_str("seed_vc").unwrap(), MediaFileOriginModelType::SeedVc);
assert_eq!(MediaFileOriginModelType::from_str("so_vits_svc").unwrap(), MediaFileOriginModelType::SoVitsSvc);
assert_eq!(MediaFileOriginModelType::from_str("tacotron2").unwrap(), MediaFileOriginModelType::Tacotron2);
assert_eq!(MediaFileOriginModelType::from_str("mocap_net").unwrap(), MediaFileOriginModelType::MocapNet);
@@ -212,11 +196,9 @@ mod tests {
let mut variants = MediaFileOriginModelType::all_variants();
assert_eq!(variants.len(), 15);
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::FaceFusion));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::F5TTS));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::LivePortrait));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::RvcV2));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::SadTalker));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::SeedVc));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::SoVitsSvc));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::Tacotron2));
assert_eq!(variants.pop_first(), Some(MediaFileOriginModelType::MocapNet));
-1
View File
@@ -14,7 +14,6 @@ pub mod media_uploads;
pub mod model_categories;
pub mod model_weights;
pub mod prompts;
pub mod tag_uses;
pub mod trending_model_analytics;
pub mod tts_models;
pub mod usages;
@@ -1 +0,0 @@
pub mod tag_use_entity_type;
@@ -1,127 +0,0 @@
use std::collections::BTreeSet;
use serde::Deserialize;
use serde::Serialize;
#[cfg(test)]
use strum::EnumCount;
#[cfg(test)]
use strum::EnumIter;
use utoipa::ToSchema;
/// Used in the `tag_uses` table in a `VARCHAR(32)` field named `entity_type`.
#[cfg_attr(test, derive(EnumIter, EnumCount))]
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Deserialize, Serialize, ToSchema)]
pub enum TagUseEntityType {
/// Media files
#[serde(rename = "media_file")]
MediaFile,
/// Model weights
#[serde(rename = "model_weight")]
ModelWeight,
}
// TODO(bt, 2023-01-17): This desperately needs MySQL integration tests!
impl_enum_display_and_debug_using_to_str!(TagUseEntityType);
impl_mysql_enum_coders!(TagUseEntityType);
/// NB: Legacy API for older code.
impl TagUseEntityType {
pub fn to_str(&self) -> &'static str {
match self {
Self::MediaFile => "media_file",
Self::ModelWeight => "model_weight",
}
}
pub fn from_str(value: &str) -> Result<Self, String> {
match value {
"media_file" => Ok(Self::MediaFile),
"model_weight" => Ok(Self::ModelWeight),
_ => Err(format!("invalid value: {:?}", value)),
}
}
pub fn all_variants() -> BTreeSet<Self> {
// NB: BTreeSet is sorted
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
BTreeSet::from([
Self::MediaFile,
Self::ModelWeight,
])
}
}
#[cfg(test)]
mod tests {
use crate::test_helpers::assert_serialization;
use crate::by_table::tag_uses::tag_use_entity_type::TagUseEntityType;
mod serde {
use super::*;
#[test]
fn test_serialization() {
assert_serialization(TagUseEntityType::MediaFile, "media_file");
assert_serialization(TagUseEntityType::ModelWeight, "model_weight");
}
}
mod impl_methods {
use super::*;
#[test]
fn test_to_str() {
assert_eq!(TagUseEntityType::MediaFile.to_str(), "media_file");
assert_eq!(TagUseEntityType::ModelWeight.to_str(), "model_weight");
}
#[test]
fn test_from_str() {
assert_eq!(TagUseEntityType::from_str("media_file").unwrap(), TagUseEntityType::MediaFile);
assert_eq!(TagUseEntityType::from_str("model_weight").unwrap(), TagUseEntityType::ModelWeight);
assert!(TagUseEntityType::from_str("foo").is_err());
}
}
mod manual_variant_checks {
use super::*;
#[test]
fn all_variants() {
let mut variants = TagUseEntityType::all_variants();
assert_eq!(variants.len(), 2);
assert_eq!(variants.pop_first(), Some(TagUseEntityType::MediaFile));
assert_eq!(variants.pop_first(), Some(TagUseEntityType::ModelWeight));
assert_eq!(variants.pop_first(), None);
}
}
mod mechanical_checks {
use super::*;
#[test]
fn variant_length() {
use strum::IntoEnumIterator;
assert_eq!(TagUseEntityType::all_variants().len(), TagUseEntityType::iter().len());
}
#[test]
fn round_trip() {
for variant in TagUseEntityType::all_variants() {
assert_eq!(variant, TagUseEntityType::from_str(variant.to_str()).unwrap());
assert_eq!(variant, TagUseEntityType::from_str(&format!("{}", variant)).unwrap());
assert_eq!(variant, TagUseEntityType::from_str(&format!("{:?}", variant)).unwrap());
}
}
#[test]
fn serialized_length_ok_for_database() {
const MAX_LENGTH : usize = 32;
for variant in TagUseEntityType::all_variants() {
let serialized = variant.to_str();
assert!(serialized.len() > 0, "variant {:?} is too short", variant);
assert!(serialized.len() <= MAX_LENGTH, "variant {:?} is too long", variant);
}
}
}
}
@@ -1,2 +1 @@
pub mod user_feature_flag;
pub mod user_signup_method;
pub mod user_feature_flag;
@@ -1,128 +0,0 @@
use std::collections::BTreeSet;
#[cfg(test)]
use strum::EnumCount;
#[cfg(test)]
use strum::EnumIter;
use utoipa::ToSchema;
/// Used in the `users` table in a `VARCHAR(16)` field.
///
/// DO NOT CHANGE VALUES WITHOUT A MIGRATION STRATEGY.
#[cfg_attr(test, derive(EnumIter, EnumCount))]
#[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Deserialize, Serialize, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum UserSignupMethod {
/// Email + Password
EmailPassword,
/// "Sign in With Google" SSO
GoogleSignIn,
}
// TODO(bt, 2022-12-21): This desperately needs MySQL integration tests!
impl_enum_display_and_debug_using_to_str!(UserSignupMethod);
impl_mysql_enum_coders!(UserSignupMethod);
impl_mysql_from_row!(UserSignupMethod);
/// NB: Legacy API for older code.
impl UserSignupMethod {
pub fn to_str(&self) -> &'static str {
match self {
Self::EmailPassword => "email_password",
Self::GoogleSignIn=> "google_sign_in",
}
}
pub fn from_str(value: &str) -> Result<Self, String> {
match value {
"email_password" => Ok(Self::EmailPassword),
"google_sign_in" => Ok(Self::GoogleSignIn),
_ => Err(format!("invalid value: {:?}", value)),
}
}
pub fn all_variants() -> BTreeSet<Self> {
// NB: BTreeSet is sorted
// NB: BTreeSet::from() isn't const, but not worth using LazyStatic, etc.
BTreeSet::from([
Self::EmailPassword,
Self::GoogleSignIn,
])
}
}
#[cfg(test)]
mod tests {
use crate::by_table::users::user_signup_method::UserSignupMethod;
use crate::test_helpers::assert_serialization;
mod serde {
use super::*;
#[test]
fn test_serialization() {
assert_serialization(UserSignupMethod::EmailPassword, "email_password");
assert_serialization(UserSignupMethod::GoogleSignIn, "google_sign_in");
}
}
mod impl_methods {
use super::*;
#[test]
fn to_str() {
assert_eq!(UserSignupMethod::EmailPassword.to_str(), "email_password");
assert_eq!(UserSignupMethod::GoogleSignIn.to_str(), "google_sign_in");
}
#[test]
fn from_str() {
assert_eq!(UserSignupMethod::from_str("email_password").unwrap(), UserSignupMethod::EmailPassword);
assert_eq!(UserSignupMethod::from_str("google_sign_in").unwrap(), UserSignupMethod::GoogleSignIn);
assert!(UserSignupMethod::from_str("foo").is_err());
}
}
mod manual_variant_checks {
use super::*;
#[test]
fn all_variants() {
let mut variants = UserSignupMethod::all_variants();
assert_eq!(variants.len(), 2);
assert_eq!(variants.pop_first(), Some(UserSignupMethod::EmailPassword));
assert_eq!(variants.pop_first(), Some(UserSignupMethod::GoogleSignIn));
assert_eq!(variants.pop_first(), None);
}
}
mod mechanical_checks {
use super::*;
#[test]
fn variant_length() {
use strum::IntoEnumIterator;
assert_eq!(UserSignupMethod::all_variants().len(), UserSignupMethod::iter().len());
}
#[test]
fn round_trip() {
for variant in UserSignupMethod::all_variants() {
assert_eq!(variant, UserSignupMethod::from_str(variant.to_str()).unwrap());
assert_eq!(variant, UserSignupMethod::from_str(&format!("{}", variant)).unwrap());
assert_eq!(variant, UserSignupMethod::from_str(&format!("{:?}", variant)).unwrap());
}
}
#[test]
fn serialized_length_ok_for_database() {
const MAX_LENGTH : usize = 16;
for variant in UserSignupMethod::all_variants() {
let serialized = variant.to_str();
assert!(serialized.len() > 0, "variant {:?} is too short", variant);
assert!(serialized.len() <= MAX_LENGTH, "variant {:?} is too long", variant);
}
}
}
}
@@ -1,3 +1,12 @@
// UPGRADE NOTES
// sqlx 0.7.2 --> 0.8.2
// - sqlx_mysql::MySqlTypeInfo --> sqlx::mysql::MySqlTypeInfo
// - sqlx_mysql::MySqlValueRef<'r> --> sqlx::mysql::MySqlValueRef<'r>
// - encode_by_ref(...) took &mut <sqlx::MySql as sqlx_core::database::HasArguments<'q>>::ArgumentBuffer
// --> now takes &mut <sqlx::MySql as sqlx::database::Database>::ArgumentBuffer<'q>
// - encode_by_ref(...) returned sqlx_core::encode::IsNull
// --> now returns Result<sqlx_core::encode::IsNull, sqlx_core::error::BoxDynError>
/// This overt approach is being taken because of the following error:
///
/// `MySqlDatabaseError { code: Some("HY000"), number: 1210, message: "Incorrect arguments to mysqld_stmt_execute" }`
@@ -13,7 +22,7 @@ macro_rules! impl_mysql_enum_coders {
($t:ident) => {
impl sqlx::Type<sqlx::MySql> for $t {
fn type_info() -> sqlx_mysql::MySqlTypeInfo {
fn type_info() -> sqlx::mysql::MySqlTypeInfo {
// // 0.4.x series:
// String::type_info()
@@ -25,8 +34,8 @@ macro_rules! impl_mysql_enum_coders {
impl<'q> sqlx::Encode<'q, sqlx::MySql> for $t {
fn encode_by_ref(
&self,
buf: &mut <sqlx::MySql as sqlx_core::database::HasArguments<'q>>::ArgumentBuffer
) -> sqlx_core::encode::IsNull {
buf: &mut <sqlx::MySql as sqlx::database::Database>::ArgumentBuffer<'q>,
) -> Result<sqlx::encode::IsNull, sqlx::error::BoxDynError> {
// // 0.4.x series:
// // NB: In the absence of `#[derive(sqlx::Type)]` and `#sqlx(rename_all="lowercase")]`,
// // this controls the casing of the variants when sent to MySQL.
@@ -41,7 +50,7 @@ macro_rules! impl_mysql_enum_coders {
impl<'r> sqlx::Decode<'r, sqlx::MySql> for $t {
fn decode(
value: sqlx_mysql::MySqlValueRef<'r>,
value: sqlx::mysql::MySqlValueRef<'r>,
) -> Result<Self, sqlx_core::error::BoxDynError> {
// // 0.4.x series:
// let string = String::decode(value)?;
@@ -1,3 +1,7 @@
// UPGRADE NOTES
// sqlx 0.7.2 --> 0.8.2
// - use sqlx::Error --> use sqlx_core::Error
// - use sqlx::Row --> use sqlx_core::row::Row
/// Implement `MySqlFromRow` on a type.
macro_rules! impl_mysql_from_row {
@@ -5,8 +9,9 @@ macro_rules! impl_mysql_from_row {
// Try to convert a MySQL row and named field into the value type (for non-nullable fields).
impl crate::traits::mysql_from_row::MySqlFromRow<$t> for $t {
fn try_from_mysql_row(row: &sqlx_mysql::MySqlRow, field_name: &str) -> Result<$t, sqlx::Error> {
use sqlx::{Error, Row};
fn try_from_mysql_row(row: &sqlx_mysql::MySqlRow, field_name: &str) -> Result<$t, sqlx_core::Error> {
use sqlx_core::Error;
use sqlx_core::row::Row;
// NB(bt,2023-12-05): For now only string encodings are considered.
// We may want to revisit in the future if we deal with binary data.
@@ -24,8 +29,9 @@ macro_rules! impl_mysql_from_row {
}
// Try to convert a MySQL row and named field into the value type (for nullable fields).
fn try_from_mysql_row_nullable(row: &sqlx_mysql::MySqlRow, field_name: &str) -> Result<Option<$t>, sqlx::Error> {
use sqlx::{Error, Row};
fn try_from_mysql_row_nullable(row: &sqlx_mysql::MySqlRow, field_name: &str) -> Result<Option<$t>, sqlx_core::Error> {
use sqlx_core::Error;
use sqlx_core::row::Row;
// NB(bt,2023-12-05): For now only string encodings are considered.
// We may want to revisit in the future if we deal with binary data.
@@ -1,11 +1,15 @@
use sqlx_mysql::MySqlRow;
// UPGRADE NOTES
// sqlx 0.7.2 --> 0.8.2
// - use sqlx::Error --> use sqlx_core::Error
/// This is a trait (in conjunction with the macro implementation) that makes up for sqlx's
/// QueryBuilder not playing well with FromRow implementation or derivation of named types.
pub trait MySqlFromRow<T> {
/// Attempt to parse a named column from a MySqlRow into the type.
fn try_from_mysql_row(row: &MySqlRow, field_name: &str) -> Result<T, sqlx::Error>;
fn try_from_mysql_row(row: &MySqlRow, field_name: &str) -> Result<T, sqlx_core::Error>;
fn try_from_mysql_row_nullable(row: &MySqlRow, field_name: &str) -> Result<Option<T>, sqlx::Error>;
fn try_from_mysql_row_nullable(row: &MySqlRow, field_name: &str) -> Result<Option<T>, sqlx_core::Error>;
}
@@ -0,0 +1,62 @@
use chrono::Utc;
use sqlx::MySqlPool;
use sqlx_core::any::AnyConnectionBackend;
use sqlx_core::connection::Connection;
use sqlx::{MySqlConnection, Executor};
use errors::AnyhowResult;
#[test]
fn test_that_this_compiles() {
// This test only exists as an integration test with the package.
// When we do upgrades of SQLx, the binding between sqlx, our macros,
// and our code can break down. Having this thin use case helps us
// deal with migration difficulties.
//
// Unfortunately this code requires access to a database or cached queries to compile, so
// we may want to rethink this strategy in the future.
assert_eq!(1, 1);
}
/// Query available (non-deleted) API tokens for a user.
/// A user can only have five active tokens at a time, so we only return the five most recent.
pub async fn list_available_api_tokens_for_user(
user_token: &str,
pool: &MySqlPool,
) -> AnyhowResult<()> {
let _records : Vec<AvailableApiTokenInternal> = sqlx::query_as!(
AvailableApiTokenInternal,
r#"
SELECT
true as testing,
internal_token
-- api_token
-- maybe_short_description
-- created_at,
-- updated_at
FROM api_tokens
WHERE
user_token = ?
AND deleted_at IS NULL
ORDER BY created_at DESC
LIMIT 5
"#,
user_token,
)
.fetch_all(pool)
.await?;
Ok(())
}
#[derive(Debug)]
struct AvailableApiTokenInternal {
pub testing: i64,
pub internal_token: String,
//pub api_token: String,
//pub maybe_short_description: Option<String>,
//pub created_at: chrono::DateTime<Utc>,
//pub updated_at: chrono::DateTime<Utc>,
}
@@ -0,0 +1,82 @@
use sqlx::mysql::MySqlRow;
use sqlx::{FromRow, MySql, MySqlPool, QueryBuilder, Row};
use enums::by_table::media_files::media_file_class::MediaFileClass;
use enums::by_table::media_files::media_file_type::MediaFileType;
use enums::common::visibility::Visibility;
use enums::traits::mysql_from_row::MySqlFromRow;
#[test]
fn test_that_this_compiles() {
// This test only exists as an integration test with the package.
// When we do upgrades of SQLx, the binding between sqlx, our macros,
// and our code can break down. Having this thin use case helps us
// deal with migration difficulties.
//
// Unfortunately this code requires access to a database or cached queries to compile, so
// we may want to rethink this strategy in the future.
assert_eq!(1, 1);
}
pub async fn test_query(mysql_pool: &MySqlPool) {
let mut query = query_builder();
let query = query.build_query_as::<MediaFileListItemInternal>();
let _results = query.fetch_all(mysql_pool).await;
}
fn query_builder<'a>() -> QueryBuilder<'a, MySql> {
// NB: Query cannot be statically checked by sqlx
let mut query_builder: QueryBuilder<MySql> = QueryBuilder::new(
r#"
SELECT
m.id,
m.media_class,
m.media_type,
m.creator_set_visibility
FROM media_files AS m
LEFT OUTER JOIN users AS u
ON m.maybe_creator_user_token = u.token
LEFT OUTER JOIN model_weights as w
ON m.maybe_origin_model_token = w.token
LEFT OUTER JOIN media_files as media_file_cover_image
ON media_file_cover_image.token = m.maybe_cover_image_media_file_token
LEFT OUTER JOIN entity_stats
ON entity_stats.entity_type = "media_file"
AND entity_stats.entity_token = m.token
LEFT OUTER JOIN prompts
ON prompts.token = m.maybe_prompt_token
"#
);
query_builder
}
struct MediaFileListItemInternal {
id: i64,
media_class: MediaFileClass,
media_type: MediaFileType,
creator_set_visibility: Visibility,
}
// NB(bt,2023-12-05): There's an issue with type hinting in the `as` clauses with QueryBuilder (or
// raw query strings) and sqlx::FromRow, regardless of whether it is derived of manually
// implemented. Perhaps this will improve in the future, but for now manually constructed queries
// cannot have type hints, eg. the following:
//
// m.token as `token: tokens::tokens::media_files::MediaFileToken`,
// m.origin_category as `origin_category: enums::by_table::media_files::media_file_origin_category::MediaFileOriginCategory`,
// m.creator_set_visibility as `creator_set_visibility: enums::common::visibility::Visibility`,
//
// This results in the automatic mapping not being able to be found by name (for macro derive), and
// in the manual case `row.try_get()` etc. won't have the correct column name (since the name is the
// full "as" clause).
impl FromRow<'_, MySqlRow> for MediaFileListItemInternal {
fn from_row(row: &MySqlRow) -> Result<Self, sqlx::Error> {
Ok(Self {
id: row.try_get("id")?,
media_class: MediaFileClass::try_from_mysql_row(row, "media_class")?,
media_type: MediaFileType::try_from_mysql_row(row, "media_type")?,
creator_set_visibility: Visibility::try_from_mysql_row(row, "creator_set_visibility")?,
})
}
}
+4 -3
View File
@@ -16,11 +16,12 @@ path = "src/lib.rs"
normal = ["my-workspace-hack"]
[dependencies]
# Workspace hack (faster compile times)
my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
# Internal
enums = { path = "../enums" }
errors = { path = "../../lib/errors" }
# Workspace hack (faster compile times)
my-workspace-hack = { version = "0.1", path = "../../my-workspace-hack" }
# Serialization
serde = "1.0.125"
@@ -30,8 +30,6 @@ pub enum PublicInferenceJobType {
GptSovits,
#[serde(rename = "f5_tts")]
F5TTS,
// ======= Everything else is the same =======
/// Jobs that run ComfyUI workflows
@@ -39,10 +37,6 @@ pub enum PublicInferenceJobType {
#[deprecated(note = "Use VideoRender instead.")]
ComfyUi,
/// Second gen studio
#[serde(rename = "studio_gen2")]
StudioGen2,
/// A job that turns "FBX" game engine files into "GLTF" files (Bevy-compatible).
#[serde(rename = "convert_fbx_gltf")]
ConvertFbxToGltf,
@@ -57,10 +51,6 @@ pub enum PublicInferenceJobType {
/// SadTalker does image-to-video lip-syncing when given an audio file and image.
SadTalker,
/// Seed-VC
#[serde(rename = "seed_vc")]
SeedVc,
/// so-vits-svc voice conversion. This predates RVCv2.
SoVitsSvc,
@@ -104,14 +94,11 @@ impl PublicInferenceJobType {
// Conserved variants
InferenceJobType::VideoRender => Self::VideoRender,
InferenceJobType::GptSovits => Self::GptSovits,
InferenceJobType::F5TTS => Self::F5TTS,
InferenceJobType::ComfyUi => Self::ComfyUi,
InferenceJobType::StudioGen2 => Self::StudioGen2,
InferenceJobType::ConvertFbxToGltf => Self::ConvertFbxToGltf,
InferenceJobType::MocapNet => Self::MocapNet,
InferenceJobType::RvcV2 => Self::RvcV2,
InferenceJobType::SadTalker => Self::SadTalker,
InferenceJobType::SeedVc => Self::SeedVc,
InferenceJobType::SoVitsSvc => Self::SoVitsSvc,
InferenceJobType::StableDiffusion => Self::StableDiffusion,
InferenceJobType::StyleTTS2 => Self::StyleTTS2,
@@ -130,14 +117,11 @@ impl PublicInferenceJobType {
// Conserved variants
Self::VideoRender => InferenceJobType::VideoRender,
Self::GptSovits => InferenceJobType::GptSovits,
Self::F5TTS => InferenceJobType::F5TTS,
Self::ComfyUi => InferenceJobType::ComfyUi,
Self::StudioGen2 => InferenceJobType::StudioGen2,
Self::ConvertFbxToGltf => InferenceJobType::ConvertFbxToGltf,
Self::MocapNet => InferenceJobType::MocapNet,
Self::RvcV2 => InferenceJobType::RvcV2,
Self::SadTalker => InferenceJobType::SadTalker,
Self::SeedVc => InferenceJobType::SeedVc,
Self::SoVitsSvc => InferenceJobType::SoVitsSvc,
Self::StableDiffusion => InferenceJobType::StableDiffusion,
Self::StyleTTS2 => InferenceJobType::StyleTTS2,
@@ -55,12 +55,6 @@ pub enum PublicMediaFileModelType {
#[serde(rename = "gpt_sovits")]
GptSovits,
#[serde(rename = "f5_tts")]
F5TTS,
#[serde(rename = "seed_vc")]
SeedVc,
#[serde(rename = "studio")]
StorytellerStudio,
@@ -92,12 +86,10 @@ impl PublicMediaFileModelType {
// Conserved variants
MediaFileOriginModelType::RvcV2 => Self::RvcV2,
MediaFileOriginModelType::SoVitsSvc => Self::SoVitsSvc,
MediaFileOriginModelType::SeedVc => Self::SeedVc,
MediaFileOriginModelType::Tacotron2 => Self::Tacotron2,
MediaFileOriginModelType::MocapNet => Self::MocapNet,
MediaFileOriginModelType::StableDiffusion15 => Self::StableDiffusion15,
MediaFileOriginModelType::GptSovits => Self::GptSovits,
MediaFileOriginModelType::F5TTS => Self::F5TTS,
MediaFileOriginModelType::StorytellerStudio => Self::StorytellerStudio,
MediaFileOriginModelType::VideoStyleTransfer => Self::VideoStyleTransfer,
MediaFileOriginModelType::ComfyUi => Self::ComfyUi,
@@ -116,12 +108,10 @@ impl PublicMediaFileModelType {
// Conserved variants
Self::RvcV2 => MediaFileOriginModelType::RvcV2,
Self::SoVitsSvc => MediaFileOriginModelType::SoVitsSvc,
Self::SeedVc => MediaFileOriginModelType::SeedVc,
Self::Tacotron2 => MediaFileOriginModelType::Tacotron2,
Self::MocapNet => MediaFileOriginModelType::MocapNet,
Self::StableDiffusion15 => MediaFileOriginModelType::StableDiffusion15,
Self::GptSovits => MediaFileOriginModelType::GptSovits,
Self::F5TTS => MediaFileOriginModelType::F5TTS,
Self::StorytellerStudio => MediaFileOriginModelType::StorytellerStudio,
Self::VideoStyleTransfer => MediaFileOriginModelType::VideoStyleTransfer,
Self::ComfyUi => MediaFileOriginModelType::ComfyUi,
+1 -1
View File
@@ -31,7 +31,7 @@ serde = "1.0.125"
serde_derive = "1.0.125"
# MySql Database
sqlx = { version = "0.7.2", features = [ "mysql", "runtime-tokio", "tls-rustls", "chrono" ] }
sqlx = { version = "0.8.2", features = [ "mysql", "runtime-tokio", "tls-rustls", "chrono" ] }
[dev-dependencies]
# Test serialization

Some files were not shown because too many files have changed in this diff Show More