diff --git a/.sqlx/query-d672be5ae066efe9678be495580f63660684cdb61af270631fe29dfca2ed466c.json b/.sqlx/query-d672be5ae066efe9678be495580f63660684cdb61af270631fe29dfca2ed466c.json new file mode 100644 index 000000000..5a4059bfb --- /dev/null +++ b/.sqlx/query-d672be5ae066efe9678be495580f63660684cdb61af270631fe29dfca2ed466c.json @@ -0,0 +1,71 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO releases (\n crate_id, version, release_time,\n dependencies, target_name, yanked, build_status,\n rustdoc_status, test_status, license, repository_url,\n homepage_url, description, description_long, readme,\n keywords, have_examples, downloads, files,\n doc_targets, is_library, doc_rustc_version,\n documentation_url, default_target, features,\n repository_id, archive_storage\n )\n VALUES (\n $1, $2, $3, $4, $5, $6, $7, $8, $9,\n $10, $11, $12, $13, $14, $15, $16, $17, $18,\n $19, $20, $21, $22, $23, $24, $25, $26, $27\n )\n ON CONFLICT (crate_id, version) DO UPDATE\n SET release_time = $3,\n dependencies = $4,\n target_name = $5,\n yanked = $6,\n build_status = $7,\n rustdoc_status = $8,\n test_status = $9,\n license = $10,\n repository_url = $11,\n homepage_url = $12,\n description = $13,\n description_long = $14,\n readme = $15,\n keywords = $16,\n have_examples = $17,\n downloads = $18,\n files = $19,\n doc_targets = $20,\n is_library = $21,\n doc_rustc_version = $22,\n documentation_url = $23,\n default_target = $24,\n features = $25,\n repository_id = $26,\n archive_storage = $27\n RETURNING id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int4" + } + ], + "parameters": { + "Left": [ + "Int4", + "Varchar", + "Timestamptz", + "Json", + "Varchar", + "Bool", + "Bool", + "Bool", + "Bool", + "Varchar", + "Varchar", + "Varchar", + "Varchar", + "Varchar", + "Varchar", + "Json", + "Bool", + "Int4", + "Json", + "Json", + "Bool", + "Varchar", + "Varchar", + "Varchar", + { + "Custom": { + "name": "_feature", + "kind": { + "Array": { + "Custom": { + "name": "feature", + "kind": { + "Composite": [ + [ + "name", + "Text" + ], + [ + "subfeatures", + "TextArray" + ] + ] + } + } + } + } + } + }, + "Int4", + "Bool" + ] + }, + "nullable": [ + false + ] + }, + "hash": "d672be5ae066efe9678be495580f63660684cdb61af270631fe29dfca2ed466c" +} diff --git a/src/db/add_package.rs b/src/db/add_package.rs index 2285ebc95..d83c2b901 100644 --- a/src/db/add_package.rs +++ b/src/db/add_package.rs @@ -49,7 +49,7 @@ pub(crate) async fn add_package_into_database( let features = get_features(metadata_pkg); let is_library = metadata_pkg.is_library(); - let release_id: i32 = sqlx::query_scalar( + let release_id: i32 = sqlx::query_scalar!( "INSERT INTO releases ( crate_id, version, release_time, dependencies, target_name, yanked, build_status, @@ -92,34 +92,34 @@ pub(crate) async fn add_package_into_database( repository_id = $26, archive_storage = $27 RETURNING id", + crate_id, + &metadata_pkg.version, + registry_data.release_time, + serde_json::to_value(dependencies)?, + metadata_pkg.package_name(), + registry_data.yanked, + res.successful, + has_docs, + false, // TODO: Add test status somehow + metadata_pkg.license, + metadata_pkg.repository, + metadata_pkg.homepage, + metadata_pkg.description, + rustdoc, + readme, + serde_json::to_value(&metadata_pkg.keywords)?, + has_examples, + registry_data.downloads, + source_files, + serde_json::to_value(doc_targets)?, + is_library, + &res.rustc_version, + metadata_pkg.documentation, + default_target, + features as Vec, + repository_id, + archive_storage ) - .bind(crate_id) - .bind(&metadata_pkg.version) - .bind(registry_data.release_time) - .bind(serde_json::to_value(dependencies)?) - .bind(metadata_pkg.package_name()) - .bind(registry_data.yanked) - .bind(res.successful) - .bind(has_docs) - .bind(false) // TODO: Add test status somehow - .bind(&metadata_pkg.license) - .bind(&metadata_pkg.repository) - .bind(&metadata_pkg.homepage) - .bind(&metadata_pkg.description) - .bind(rustdoc) - .bind(readme) - .bind(serde_json::to_value(&metadata_pkg.keywords)?) - .bind(has_examples) - .bind(registry_data.downloads) - .bind(source_files) - .bind(serde_json::to_value(doc_targets)?) - .bind(is_library) - .bind(&res.rustc_version) - .bind(&metadata_pkg.documentation) - .bind(default_target) - .bind(features) - .bind(repository_id) - .bind(archive_storage) .fetch_one(&mut *conn) .await?;