From ffec2c989742398b4103057ea087cc90090bd50f Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Tue, 7 Oct 2025 15:57:54 +0200 Subject: [PATCH] diesel: Use `column_sorting = name` This ensures that the order in which migrations are applied does not change the order of this file. --- crates/crates_io_database/src/schema.patch | 36 +- crates/crates_io_database/src/schema.rs | 678 ++++++++++----------- diesel.toml | 1 + 3 files changed, 361 insertions(+), 354 deletions(-) diff --git a/crates/crates_io_database/src/schema.patch b/crates/crates_io_database/src/schema.patch index 076cea40cf6..5952840d96f 100644 --- a/crates/crates_io_database/src/schema.patch +++ b/crates/crates_io_database/src/schema.patch @@ -11,41 +11,47 @@ } diesel::table! { -@@ -67,9 +65,9 @@ - /// (Automatically generated by Diesel.) - revoked -> Bool, +@@ -25,7 +23,7 @@ + /// (Automatically generated by Diesel.) + api_tokens (id) { /// NULL or an array of crate scope patterns (see RFC #2947) - crate_scopes -> Nullable>>, + crate_scopes -> Nullable>, + /// The `created_at` column of the `api_tokens` table. + /// + /// Its SQL type is `Timestamptz`. +@@ -33,7 +31,7 @@ + /// (Automatically generated by Diesel.) + created_at -> Timestamptz, /// An array of endpoint scopes or NULL for the `legacy` endpoint scope (see RFC #2947) - endpoint_scopes -> Nullable>>, + endpoint_scopes -> Nullable>, /// The `expired_at` column of the `api_tokens` table. /// /// Its SQL type is `Nullable`. -@@ -175,12 +173,6 @@ +@@ -169,12 +167,6 @@ /// /// (Automatically generated by Diesel.) - created_at -> Timestamptz, + id -> Int4, - /// The `path` column of the `categories` table. - /// - /// Its SQL type is `Ltree`. - /// - /// (Automatically generated by Diesel.) - path -> Ltree, - } - } - -@@ -483,7 +475,7 @@ + /// The `slug` column of the `categories` table. + /// + /// Its SQL type is `Varchar`. +@@ -477,7 +469,7 @@ /// Its SQL type is `Array>`. /// /// (Automatically generated by Diesel.) - features -> Array>, + features -> Array, - /// The `target` column of the `dependencies` table. + /// The `id` column of the `dependencies` table. /// - /// Its SQL type is `Nullable`. -@@ -710,6 +702,24 @@ + /// Its SQL type is `Int4`. +@@ -722,6 +714,24 @@ } diesel::table! { @@ -70,7 +76,7 @@ /// Representation of the `reserved_crate_names` table. /// /// (Automatically generated by Diesel.) -@@ -1094,7 +1104,8 @@ +@@ -1130,7 +1140,8 @@ diesel::joinable!(crate_downloads -> crates (crate_id)); diesel::joinable!(crate_owner_invitations -> crates (crate_id)); diesel::joinable!(crate_owners -> crates (crate_id)); @@ -80,7 +86,7 @@ diesel::joinable!(crates_categories -> categories (category_id)); diesel::joinable!(crates_categories -> crates (crate_id)); diesel::joinable!(crates_keywords -> crates (crate_id)); -@@ -1110,6 +1121,7 @@ +@@ -1146,6 +1157,7 @@ diesel::joinable!(publish_limit_buckets -> users (user_id)); diesel::joinable!(publish_rate_overrides -> users (user_id)); diesel::joinable!(readme_renderings -> versions (version_id)); @@ -88,7 +94,7 @@ diesel::joinable!(trustpub_configs_github -> crates (crate_id)); diesel::joinable!(trustpub_configs_gitlab -> crates (crate_id)); diesel::joinable!(version_downloads -> versions (version_id)); -@@ -1140,6 +1152,7 @@ +@@ -1178,6 +1190,7 @@ publish_limit_buckets, publish_rate_overrides, readme_renderings, diff --git a/crates/crates_io_database/src/schema.rs b/crates/crates_io_database/src/schema.rs index 743842a7321..5ce0cbca304 100644 --- a/crates/crates_io_database/src/schema.rs +++ b/crates/crates_io_database/src/schema.rs @@ -22,60 +22,60 @@ diesel::table! { /// /// (Automatically generated by Diesel.) api_tokens (id) { - /// The `id` column of the `api_tokens` table. + /// NULL or an array of crate scope patterns (see RFC #2947) + crate_scopes -> Nullable>, + /// The `created_at` column of the `api_tokens` table. /// - /// Its SQL type is `Int4`. + /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) - id -> Int4, - /// The `user_id` column of the `api_tokens` table. + created_at -> Timestamptz, + /// An array of endpoint scopes or NULL for the `legacy` endpoint scope (see RFC #2947) + endpoint_scopes -> Nullable>, + /// The `expired_at` column of the `api_tokens` table. + /// + /// Its SQL type is `Nullable`. + /// + /// (Automatically generated by Diesel.) + expired_at -> Nullable, + /// timestamp of when the user was informed about their token's impending expiration + expiry_notification_at -> Nullable, + /// The `id` column of the `api_tokens` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - user_id -> Int4, - /// The `token` column of the `api_tokens` table. + id -> Int4, + /// The `last_used_at` column of the `api_tokens` table. /// - /// Its SQL type is `Bytea`. + /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) - token -> Bytea, + last_used_at -> Nullable, /// The `name` column of the `api_tokens` table. /// /// Its SQL type is `Varchar`. /// /// (Automatically generated by Diesel.) name -> Varchar, - /// The `created_at` column of the `api_tokens` table. - /// - /// Its SQL type is `Timestamptz`. - /// - /// (Automatically generated by Diesel.) - created_at -> Timestamptz, - /// The `last_used_at` column of the `api_tokens` table. - /// - /// Its SQL type is `Nullable`. - /// - /// (Automatically generated by Diesel.) - last_used_at -> Nullable, /// The `revoked` column of the `api_tokens` table. /// /// Its SQL type is `Bool`. /// /// (Automatically generated by Diesel.) revoked -> Bool, - /// NULL or an array of crate scope patterns (see RFC #2947) - crate_scopes -> Nullable>, - /// An array of endpoint scopes or NULL for the `legacy` endpoint scope (see RFC #2947) - endpoint_scopes -> Nullable>, - /// The `expired_at` column of the `api_tokens` table. + /// The `token` column of the `api_tokens` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Bytea`. /// /// (Automatically generated by Diesel.) - expired_at -> Nullable, - /// timestamp of when the user was informed about their token's impending expiration - expiry_notification_at -> Nullable, + token -> Bytea, + /// The `user_id` column of the `api_tokens` table. + /// + /// Its SQL type is `Int4`. + /// + /// (Automatically generated by Diesel.) + user_id -> Int4, } } @@ -84,48 +84,48 @@ diesel::table! { /// /// (Automatically generated by Diesel.) background_jobs (id) { - /// The `id` column of the `background_jobs` table. - /// - /// Its SQL type is `Int8`. - /// - /// (Automatically generated by Diesel.) - id -> Int8, - /// The `job_type` column of the `background_jobs` table. + /// The `created_at` column of the `background_jobs` table. /// - /// Its SQL type is `Text`. + /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) - job_type -> Text, + created_at -> Timestamptz, /// The `data` column of the `background_jobs` table. /// /// Its SQL type is `Jsonb`. /// /// (Automatically generated by Diesel.) data -> Jsonb, - /// The `retries` column of the `background_jobs` table. + /// The `id` column of the `background_jobs` table. /// - /// Its SQL type is `Int4`. + /// Its SQL type is `Int8`. /// /// (Automatically generated by Diesel.) - retries -> Int4, - /// The `last_retry` column of the `background_jobs` table. + id -> Int8, + /// The `job_type` column of the `background_jobs` table. /// - /// Its SQL type is `Timestamptz`. + /// Its SQL type is `Text`. /// /// (Automatically generated by Diesel.) - last_retry -> Timestamptz, - /// The `created_at` column of the `background_jobs` table. + job_type -> Text, + /// The `last_retry` column of the `background_jobs` table. /// /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) - created_at -> Timestamptz, + last_retry -> Timestamptz, /// The `priority` column of the `background_jobs` table. /// /// Its SQL type is `Int2`. /// /// (Automatically generated by Diesel.) priority -> Int2, + /// The `retries` column of the `background_jobs` table. + /// + /// Its SQL type is `Int4`. + /// + /// (Automatically generated by Diesel.) + retries -> Int4, } } @@ -137,54 +137,54 @@ diesel::table! { /// /// (Automatically generated by Diesel.) categories (id) { - /// The `id` column of the `categories` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - id -> Int4, /// The `category` column of the `categories` table. /// /// Its SQL type is `Varchar`. /// /// (Automatically generated by Diesel.) category -> Varchar, - /// The `slug` column of the `categories` table. + /// The `crates_cnt` column of the `categories` table. /// - /// Its SQL type is `Varchar`. + /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - slug -> Varchar, + crates_cnt -> Int4, + /// The `created_at` column of the `categories` table. + /// + /// Its SQL type is `Timestamptz`. + /// + /// (Automatically generated by Diesel.) + created_at -> Timestamptz, /// The `description` column of the `categories` table. /// /// Its SQL type is `Varchar`. /// /// (Automatically generated by Diesel.) description -> Varchar, - /// The `crates_cnt` column of the `categories` table. + /// The `id` column of the `categories` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - crates_cnt -> Int4, - /// The `created_at` column of the `categories` table. + id -> Int4, + /// The `slug` column of the `categories` table. /// - /// Its SQL type is `Timestamptz`. + /// Its SQL type is `Varchar`. /// /// (Automatically generated by Diesel.) - created_at -> Timestamptz, + slug -> Varchar, } } diesel::table! { /// Queue for batching CloudFront CDN invalidation requests cloudfront_invalidation_queue (id) { + /// Timestamp when the path was queued for invalidation + created_at -> Timestamptz, /// Unique identifier for each queued invalidation path id -> Int8, /// CloudFront path to invalidate (e.g. /crates/serde/serde-1.0.0.crate) path -> Text, - /// Timestamp when the path was queued for invalidation - created_at -> Timestamptz, } } @@ -203,38 +203,38 @@ diesel::table! { /// /// (Automatically generated by Diesel.) crate_owner_invitations (invited_user_id, crate_id) { - /// The `invited_user_id` column of the `crate_owner_invitations` table. + /// The `crate_id` column of the `crate_owner_invitations` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - invited_user_id -> Int4, - /// The `invited_by_user_id` column of the `crate_owner_invitations` table. + crate_id -> Int4, + /// The `created_at` column of the `crate_owner_invitations` table. /// - /// Its SQL type is `Int4`. + /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) - invited_by_user_id -> Int4, - /// The `crate_id` column of the `crate_owner_invitations` table. + created_at -> Timestamptz, + /// Point in time at which the invitation expires/expired. + expires_at -> Timestamptz, + /// The `invited_by_user_id` column of the `crate_owner_invitations` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - crate_id -> Int4, - /// The `created_at` column of the `crate_owner_invitations` table. + invited_by_user_id -> Int4, + /// The `invited_user_id` column of the `crate_owner_invitations` table. /// - /// Its SQL type is `Timestamptz`. + /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - created_at -> Timestamptz, + invited_user_id -> Int4, /// The `token` column of the `crate_owner_invitations` table. /// /// Its SQL type is `Text`. /// /// (Automatically generated by Diesel.) token -> Text, - /// Point in time at which the invitation expires/expired. - expires_at -> Timestamptz, } } @@ -249,8 +249,6 @@ diesel::table! { /// /// (Automatically generated by Diesel.) crate_id -> Int4, - /// This refers either to the `users.id` or `teams.id` column, depending on the value of the `owner_kind` column - owner_id -> Int4, /// The `created_at` column of the `crate_owners` table. /// /// Its SQL type is `Timestamptz`. @@ -269,20 +267,22 @@ diesel::table! { /// /// (Automatically generated by Diesel.) deleted -> Bool, - /// The `updated_at` column of the `crate_owners` table. + /// The `email_notifications` column of the `crate_owners` table. /// - /// Its SQL type is `Timestamptz`. + /// Its SQL type is `Bool`. /// /// (Automatically generated by Diesel.) - updated_at -> Timestamptz, + email_notifications -> Bool, + /// This refers either to the `users.id` or `teams.id` column, depending on the value of the `owner_kind` column + owner_id -> Int4, /// `owner_kind = 0` refers to `users`, `owner_kind = 1` refers to `teams`. owner_kind -> Int4, - /// The `email_notifications` column of the `crate_owners` table. + /// The `updated_at` column of the `crate_owners` table. /// - /// Its SQL type is `Bool`. + /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) - email_notifications -> Bool, + updated_at -> Timestamptz, } } @@ -294,24 +294,6 @@ diesel::table! { /// /// (Automatically generated by Diesel.) crates (id) { - /// The `id` column of the `crates` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - id -> Int4, - /// The `name` column of the `crates` table. - /// - /// Its SQL type is `Varchar`. - /// - /// (Automatically generated by Diesel.) - name -> Varchar, - /// The `updated_at` column of the `crates` table. - /// - /// Its SQL type is `Timestamptz`. - /// - /// (Automatically generated by Diesel.) - updated_at -> Timestamptz, /// The `created_at` column of the `crates` table. /// /// Its SQL type is `Timestamptz`. @@ -324,48 +306,66 @@ diesel::table! { /// /// (Automatically generated by Diesel.) description -> Nullable, + /// The `documentation` column of the `crates` table. + /// + /// Its SQL type is `Nullable`. + /// + /// (Automatically generated by Diesel.) + documentation -> Nullable, /// The `homepage` column of the `crates` table. /// /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) homepage -> Nullable, - /// The `documentation` column of the `crates` table. + /// The `id` column of the `crates` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - documentation -> Nullable, - /// The `readme` column of the `crates` table. + id -> Int4, + /// The `max_features` column of the `crates` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) - readme -> Nullable, - /// The `textsearchable_index_col` column of the `crates` table. + max_features -> Nullable, + /// The `max_upload_size` column of the `crates` table. /// - /// Its SQL type is `Tsvector`. + /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) - textsearchable_index_col -> Tsvector, + max_upload_size -> Nullable, + /// The `name` column of the `crates` table. + /// + /// Its SQL type is `Varchar`. + /// + /// (Automatically generated by Diesel.) + name -> Varchar, + /// The `readme` column of the `crates` table. + /// + /// Its SQL type is `Nullable`. + /// + /// (Automatically generated by Diesel.) + readme -> Nullable, /// The `repository` column of the `crates` table. /// /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) repository -> Nullable, - /// The `max_upload_size` column of the `crates` table. + /// The `textsearchable_index_col` column of the `crates` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Tsvector`. /// /// (Automatically generated by Diesel.) - max_upload_size -> Nullable, - /// The `max_features` column of the `crates` table. + textsearchable_index_col -> Tsvector, + /// The `updated_at` column of the `crates` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) - max_features -> Nullable, + updated_at -> Timestamptz, } } @@ -374,18 +374,18 @@ diesel::table! { /// /// (Automatically generated by Diesel.) crates_categories (crate_id, category_id) { - /// The `crate_id` column of the `crates_categories` table. + /// The `category_id` column of the `crates_categories` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - crate_id -> Int4, - /// The `category_id` column of the `crates_categories` table. + category_id -> Int4, + /// The `crate_id` column of the `crates_categories` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - category_id -> Int4, + crate_id -> Int4, } } @@ -414,30 +414,30 @@ diesel::table! { default_versions (crate_id) { /// Reference to the crate in the `crates` table. crate_id -> Int4, - /// Reference to the version in the `versions` table. - version_id -> Int4, /// The total number of versions. num_versions -> Nullable, + /// Reference to the version in the `versions` table. + version_id -> Int4, } } diesel::table! { /// Crates that have been deleted by users deleted_crates (id) { - /// Unique identifier of the `deleted_crates` row - id -> Int4, - /// Name of the deleted crate (use `canon_crate_name()` for normalization, if needed) - name -> Varchar, + /// Date and time when users will be able to create a new crate with the same name + available_at -> Timestamptz, /// Date and time when the crate was created created_at -> Timestamptz, /// Date and time when the crate was deleted deleted_at -> Timestamptz, /// ID of the user who deleted the crate, or NULL if the user was deleted deleted_by -> Nullable, + /// Unique identifier of the `deleted_crates` row + id -> Int4, /// Optional message left by the user who deleted the crate message -> Nullable, - /// Date and time when users will be able to create a new crate with the same name - available_at -> Timestamptz, + /// Name of the deleted crate (use `canon_crate_name()` for normalization, if needed) + name -> Varchar, } } @@ -446,66 +446,66 @@ diesel::table! { /// /// (Automatically generated by Diesel.) dependencies (id) { - /// The `id` column of the `dependencies` table. + /// The `crate_id` column of the `dependencies` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - id -> Int4, - /// The `version_id` column of the `dependencies` table. + crate_id -> Int4, + /// The `default_features` column of the `dependencies` table. /// - /// Its SQL type is `Int4`. + /// Its SQL type is `Bool`. /// /// (Automatically generated by Diesel.) - version_id -> Int4, - /// The `crate_id` column of the `dependencies` table. + default_features -> Bool, + /// The `explicit_name` column of the `dependencies` table. /// - /// Its SQL type is `Int4`. + /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) - crate_id -> Int4, - /// The `req` column of the `dependencies` table. + explicit_name -> Nullable, + /// The `features` column of the `dependencies` table. /// - /// Its SQL type is `Varchar`. + /// Its SQL type is `Array>`. /// /// (Automatically generated by Diesel.) - req -> Varchar, - /// The `optional` column of the `dependencies` table. + features -> Array, + /// The `id` column of the `dependencies` table. /// - /// Its SQL type is `Bool`. + /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - optional -> Bool, - /// The `default_features` column of the `dependencies` table. + id -> Int4, + /// The `kind` column of the `dependencies` table. + /// + /// Its SQL type is `Int4`. + /// + /// (Automatically generated by Diesel.) + kind -> Int4, + /// The `optional` column of the `dependencies` table. /// /// Its SQL type is `Bool`. /// /// (Automatically generated by Diesel.) - default_features -> Bool, - /// The `features` column of the `dependencies` table. + optional -> Bool, + /// The `req` column of the `dependencies` table. /// - /// Its SQL type is `Array>`. + /// Its SQL type is `Varchar`. /// /// (Automatically generated by Diesel.) - features -> Array, + req -> Varchar, /// The `target` column of the `dependencies` table. /// /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) target -> Nullable, - /// The `kind` column of the `dependencies` table. + /// The `version_id` column of the `dependencies` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - kind -> Int4, - /// The `explicit_name` column of the `dependencies` table. - /// - /// Its SQL type is `Nullable`. - /// - /// (Automatically generated by Diesel.) - explicit_name -> Nullable, + version_id -> Int4, } } @@ -514,30 +514,18 @@ diesel::table! { /// /// (Automatically generated by Diesel.) emails (id) { - /// The `id` column of the `emails` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - id -> Int4, - /// The `user_id` column of the `emails` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - user_id -> Int4, /// The `email` column of the `emails` table. /// /// Its SQL type is `Varchar`. /// /// (Automatically generated by Diesel.) email -> Varchar, - /// The `verified` column of the `emails` table. + /// The `id` column of the `emails` table. /// - /// Its SQL type is `Bool`. + /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - verified -> Bool, + id -> Int4, /// The `token` column of the `emails` table. /// /// Its SQL type is `Text`. @@ -550,6 +538,18 @@ diesel::table! { /// /// (Automatically generated by Diesel.) token_generated_at -> Nullable, + /// The `user_id` column of the `emails` table. + /// + /// Its SQL type is `Int4`. + /// + /// (Automatically generated by Diesel.) + user_id -> Int4, + /// The `verified` column of the `emails` table. + /// + /// Its SQL type is `Bool`. + /// + /// (Automatically generated by Diesel.) + verified -> Bool, } } @@ -558,18 +558,18 @@ diesel::table! { /// /// (Automatically generated by Diesel.) follows (user_id, crate_id) { - /// The `user_id` column of the `follows` table. + /// The `crate_id` column of the `follows` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - user_id -> Int4, - /// The `crate_id` column of the `follows` table. + crate_id -> Int4, + /// The `user_id` column of the `follows` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - crate_id -> Int4, + user_id -> Int4, } } @@ -578,30 +578,30 @@ diesel::table! { /// /// (Automatically generated by Diesel.) keywords (id) { - /// The `id` column of the `keywords` table. + /// The `crates_cnt` column of the `keywords` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - id -> Int4, - /// The `keyword` column of the `keywords` table. + crates_cnt -> Int4, + /// The `created_at` column of the `keywords` table. /// - /// Its SQL type is `Text`. + /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) - keyword -> Text, - /// The `crates_cnt` column of the `keywords` table. + created_at -> Timestamptz, + /// The `id` column of the `keywords` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - crates_cnt -> Int4, - /// The `created_at` column of the `keywords` table. + id -> Int4, + /// The `keyword` column of the `keywords` table. /// - /// Its SQL type is `Timestamptz`. + /// Its SQL type is `Text`. /// /// (Automatically generated by Diesel.) - created_at -> Timestamptz, + keyword -> Text, } } @@ -634,30 +634,30 @@ diesel::table! { /// /// (Automatically generated by Diesel.) publish_limit_buckets (user_id, action) { - /// The `user_id` column of the `publish_limit_buckets` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - user_id -> Int4, - /// The `tokens` column of the `publish_limit_buckets` table. + /// The `action` column of the `publish_limit_buckets` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - tokens -> Int4, + action -> Int4, /// The `last_refill` column of the `publish_limit_buckets` table. /// /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) last_refill -> Timestamptz, - /// The `action` column of the `publish_limit_buckets` table. + /// The `tokens` column of the `publish_limit_buckets` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - action -> Int4, + tokens -> Int4, + /// The `user_id` column of the `publish_limit_buckets` table. + /// + /// Its SQL type is `Int4`. + /// + /// (Automatically generated by Diesel.) + user_id -> Int4, } } @@ -666,12 +666,12 @@ diesel::table! { /// /// (Automatically generated by Diesel.) publish_rate_overrides (user_id, action) { - /// The `user_id` column of the `publish_rate_overrides` table. + /// The `action` column of the `publish_rate_overrides` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - user_id -> Int4, + action -> Int4, /// The `burst` column of the `publish_rate_overrides` table. /// /// Its SQL type is `Int4`. @@ -684,12 +684,12 @@ diesel::table! { /// /// (Automatically generated by Diesel.) expires_at -> Nullable, - /// The `action` column of the `publish_rate_overrides` table. + /// The `user_id` column of the `publish_rate_overrides` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - action -> Int4, + user_id -> Int4, } } @@ -698,18 +698,18 @@ diesel::table! { /// /// (Automatically generated by Diesel.) readme_renderings (version_id) { - /// The `version_id` column of the `readme_renderings` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - version_id -> Int4, /// The `rendered_at` column of the `readme_renderings` table. /// /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) rendered_at -> Timestamptz, + /// The `version_id` column of the `readme_renderings` table. + /// + /// Its SQL type is `Int4`. + /// + /// (Automatically generated by Diesel.) + version_id -> Int4, } } @@ -750,6 +750,14 @@ diesel::table! { /// /// (Automatically generated by Diesel.) teams (id) { + /// The `avatar` column of the `teams` table. + /// + /// Its SQL type is `Nullable`. + /// + /// (Automatically generated by Diesel.) + avatar -> Nullable, + /// Unique team ID on the GitHub API. When teams are recreated with the same name then they will still get a different ID, so this allows us to avoid potential name reuse attacks. + github_id -> Int4, /// The `id` column of the `teams` table. /// /// Its SQL type is `Int4`. @@ -758,20 +766,12 @@ diesel::table! { id -> Int4, /// Example: `github:foo:bar` means the `bar` team of the `foo` GitHub organization. login -> Varchar, - /// Unique team ID on the GitHub API. When teams are recreated with the same name then they will still get a different ID, so this allows us to avoid potential name reuse attacks. - github_id -> Int4, /// The `name` column of the `teams` table. /// /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) name -> Nullable, - /// The `avatar` column of the `teams` table. - /// - /// Its SQL type is `Nullable`. - /// - /// (Automatically generated by Diesel.) - avatar -> Nullable, /// Unique organization ID on the GitHub API. When organizations are recreated with the same name then they will still get a different ID, so this allows us to avoid potential name reuse attacks. org_id -> Int4, } @@ -780,34 +780,36 @@ diesel::table! { diesel::table! { /// Trusted Publisher configuration for GitHub Actions trustpub_configs_github (id) { - /// Unique identifier of the `trustpub_configs_github` row - id -> Int4, - /// Date and time when the configuration was created - created_at -> Timestamptz, /// Unique identifier of the crate that this configuration is for crate_id -> Int4, + /// Date and time when the configuration was created + created_at -> Timestamptz, + /// GitHub Actions environment that will be used to publish the crate (if `NULL` the environment is unrestricted) + environment -> Nullable, + /// Unique identifier of the `trustpub_configs_github` row + id -> Int4, + /// Name of the repository that this configuration is for + repository_name -> Varchar, /// GitHub name of the user or organization that owns the repository repository_owner -> Varchar, /// GitHub ID of the user or organization that owns the repository repository_owner_id -> Int4, - /// Name of the repository that this configuration is for - repository_name -> Varchar, /// Name of the workflow file inside the repository that will be used to publish the crate workflow_filename -> Varchar, - /// GitHub Actions environment that will be used to publish the crate (if `NULL` the environment is unrestricted) - environment -> Nullable, } } diesel::table! { /// Trusted Publisher configuration for GitLab CI trustpub_configs_gitlab (id) { - /// Unique identifier of the `trustpub_configs_gitlab` row - id -> Int4, - /// Date and time when the configuration was created - created_at -> Timestamptz, /// Unique identifier of the crate that this configuration is for crate_id -> Int4, + /// Date and time when the configuration was created + created_at -> Timestamptz, + /// GitLab environment that will be used to publish the crate (if `NULL` the environment is unrestricted) + environment -> Nullable, + /// Unique identifier of the `trustpub_configs_gitlab` row + id -> Int4, /// GitLab namespace (user or group) that owns the project namespace -> Varchar, /// GitLab namespace ID, populated on first token exchange for resurrection attack protection @@ -816,24 +818,22 @@ diesel::table! { project -> Varchar, /// Path to the CI/CD configuration file that will be used to publish the crate workflow_filepath -> Varchar, - /// GitLab environment that will be used to publish the crate (if `NULL` the environment is unrestricted) - environment -> Nullable, } } diesel::table! { /// Temporary access tokens for Trusted Publishing trustpub_tokens (id) { - /// Unique identifier of the `trustpub_tokens` row - id -> Int8, + /// Unique identifiers of the crates that can be published using this token + crate_ids -> Array>, /// Date and time when the token was created created_at -> Timestamptz, /// Date and time when the token will expire expires_at -> Timestamptz, /// SHA256 hash of the token that can be used to publish the crate hashed_token -> Bytea, - /// Unique identifiers of the crates that can be published using this token - crate_ids -> Array>, + /// Unique identifier of the `trustpub_tokens` row + id -> Int8, /// JSONB data containing JWT claims from the trusted publisher (e.g., GitHub Actions context like repository, run_id, sha) trustpub_data -> Nullable, } @@ -842,14 +842,14 @@ diesel::table! { diesel::table! { /// Used JWT IDs to prevent token reuse in the Trusted Publishing flow trustpub_used_jtis (id) { + /// Date and time when the JWT would expire + expires_at -> Timestamptz, /// Unique identifier of the `trustpub_used_jtis` row id -> Int8, /// JWT ID from the OIDC token jti -> Varchar, /// Date and time when the JWT was used used_at -> Timestamptz, - /// Date and time when the JWT would expire - expires_at -> Timestamptz, } } @@ -858,58 +858,58 @@ diesel::table! { /// /// (Automatically generated by Diesel.) users (id) { - /// The `id` column of the `users` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - id -> Int4, - /// The `gh_login` column of the `users` table. + /// The `account_lock_reason` column of the `users` table. /// - /// Its SQL type is `Varchar`. + /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) - gh_login -> Varchar, - /// The `name` column of the `users` table. + account_lock_reason -> Nullable, + /// The `account_lock_until` column of the `users` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) - name -> Nullable, + account_lock_until -> Nullable, /// The `gh_avatar` column of the `users` table. /// /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) gh_avatar -> Nullable, + /// Encrypted GitHub access token + gh_encrypted_token -> Bytea, /// The `gh_id` column of the `users` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) gh_id -> Int4, - /// The `account_lock_reason` column of the `users` table. + /// The `gh_login` column of the `users` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Varchar`. /// /// (Automatically generated by Diesel.) - account_lock_reason -> Nullable, - /// The `account_lock_until` column of the `users` table. + gh_login -> Varchar, + /// The `id` column of the `users` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - account_lock_until -> Nullable, + id -> Int4, /// The `is_admin` column of the `users` table. /// /// Its SQL type is `Bool`. /// /// (Automatically generated by Diesel.) is_admin -> Bool, + /// The `name` column of the `users` table. + /// + /// Its SQL type is `Nullable`. + /// + /// (Automatically generated by Diesel.) + name -> Nullable, /// Whether or not the user wants to receive notifications when a package they own is published publish_notifications -> Bool, - /// Encrypted GitHub access token - gh_encrypted_token -> Bytea, } } @@ -918,18 +918,6 @@ diesel::table! { /// /// (Automatically generated by Diesel.) version_downloads (version_id, date) { - /// The `version_id` column of the `version_downloads` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - version_id -> Int4, - /// The `downloads` column of the `version_downloads` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - downloads -> Int4, /// The `counted` column of the `version_downloads` table. /// /// Its SQL type is `Int4`. @@ -942,12 +930,24 @@ diesel::table! { /// /// (Automatically generated by Diesel.) date -> Date, + /// The `downloads` column of the `version_downloads` table. + /// + /// Its SQL type is `Int4`. + /// + /// (Automatically generated by Diesel.) + downloads -> Int4, /// The `processed` column of the `version_downloads` table. /// /// Its SQL type is `Bool`. /// /// (Automatically generated by Diesel.) processed -> Bool, + /// The `version_id` column of the `version_downloads` table. + /// + /// Its SQL type is `Int4`. + /// + /// (Automatically generated by Diesel.) + version_id -> Int4, } } @@ -956,42 +956,42 @@ diesel::table! { /// /// (Automatically generated by Diesel.) version_owner_actions (id) { - /// The `id` column of the `version_owner_actions` table. + /// The `action` column of the `version_owner_actions` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - id -> Int4, - /// The `version_id` column of the `version_owner_actions` table. + action -> Int4, + /// The `api_token_id` column of the `version_owner_actions` table. /// - /// Its SQL type is `Int4`. + /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) - version_id -> Int4, - /// The `user_id` column of the `version_owner_actions` table. + api_token_id -> Nullable, + /// The `id` column of the `version_owner_actions` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - user_id -> Int4, - /// The `api_token_id` column of the `version_owner_actions` table. + id -> Int4, + /// The `time` column of the `version_owner_actions` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) - api_token_id -> Nullable, - /// The `action` column of the `version_owner_actions` table. + time -> Timestamptz, + /// The `user_id` column of the `version_owner_actions` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - action -> Int4, - /// The `time` column of the `version_owner_actions` table. + user_id -> Int4, + /// The `version_id` column of the `version_owner_actions` table. /// - /// Its SQL type is `Timestamptz`. + /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - time -> Timestamptz, + version_id -> Int4, } } @@ -1000,119 +1000,119 @@ diesel::table! { /// /// (Automatically generated by Diesel.) versions (id) { - /// The `id` column of the `versions` table. + /// list of the names of all detected binaries in the version. the list may be empty which indicates that no binaries were detected in the version. the column may be NULL is the version has not been analyzed yet. + bin_names -> Nullable>>, + /// The list of `categories` in the `Cargo.toml` file of this version. + categories -> Array>, + /// The `checksum` column of the `versions` table. /// - /// Its SQL type is `Int4`. + /// Its SQL type is `Bpchar`. /// /// (Automatically generated by Diesel.) - id -> Int4, + #[max_length = 64] + checksum -> Bpchar, /// The `crate_id` column of the `versions` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) crate_id -> Int4, - /// The `num` column of the `versions` table. - /// - /// Its SQL type is `Varchar`. - /// - /// (Automatically generated by Diesel.) - num -> Varchar, - /// The `updated_at` column of the `versions` table. + /// The `crate_size` column of the `versions` table. /// - /// Its SQL type is `Timestamptz`. + /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - updated_at -> Timestamptz, + crate_size -> Int4, /// The `created_at` column of the `versions` table. /// /// Its SQL type is `Timestamptz`. /// /// (Automatically generated by Diesel.) created_at -> Timestamptz, + /// Value of the `description` field in the `Cargo.toml` file of this version. + description -> Nullable, + /// Value of the `documentation` field in the `Cargo.toml` file of this version. + documentation -> Nullable, /// The `downloads` column of the `versions` table. /// /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) downloads -> Int4, + /// The declared Rust Edition required to compile this version of the crate. + edition -> Nullable, /// The `features` column of the `versions` table. /// /// Its SQL type is `Jsonb`. /// /// (Automatically generated by Diesel.) features -> Jsonb, - /// The `yanked` column of the `versions` table. + /// TRUE if the version has a library (e.g. `src/lib.rs`), FALSE if no library was detected, or NULL if the version has not been analyzed yet. + has_lib -> Nullable, + /// Value of the `homepage` field in the `Cargo.toml` file of this version. + homepage -> Nullable, + /// The `id` column of the `versions` table. /// - /// Its SQL type is `Bool`. + /// Its SQL type is `Int4`. /// /// (Automatically generated by Diesel.) - yanked -> Bool, + id -> Int4, + /// The list of `keywords` in the `Cargo.toml` file of this version. + keywords -> Array>, /// The `license` column of the `versions` table. /// /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) license -> Nullable, - /// The `crate_size` column of the `versions` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - crate_size -> Int4, - /// The `published_by` column of the `versions` table. + /// Source Lines of Code statistics for this version, stored as JSON with language breakdown and totals. + linecounts -> Nullable, + /// The `links` column of the `versions` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) - published_by -> Nullable, - /// The `checksum` column of the `versions` table. + links -> Nullable, + /// The `num` column of the `versions` table. /// - /// Its SQL type is `Bpchar`. + /// Its SQL type is `Varchar`. /// /// (Automatically generated by Diesel.) - #[max_length = 64] - checksum -> Bpchar, - /// The `links` column of the `versions` table. + num -> Varchar, + /// This is the same as `num` without the optional "build metadata" part (except for some versions that were published before we started validating this). + num_no_build -> Varchar, + /// The `published_by` column of the `versions` table. /// - /// Its SQL type is `Nullable`. + /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) - links -> Nullable, + published_by -> Nullable, + /// Value of the `repository` field in the `Cargo.toml` file of this version. + repository -> Nullable, /// The `rust_version` column of the `versions` table. /// /// Its SQL type is `Nullable`. /// /// (Automatically generated by Diesel.) rust_version -> Nullable, - /// TRUE if the version has a library (e.g. `src/lib.rs`), FALSE if no library was detected, or NULL if the version has not been analyzed yet. - has_lib -> Nullable, - /// list of the names of all detected binaries in the version. the list may be empty which indicates that no binaries were detected in the version. the column may be NULL is the version has not been analyzed yet. - bin_names -> Nullable>>, - /// message associated with a yanked version - yank_message -> Nullable, - /// This is the same as `num` without the optional "build metadata" part (except for some versions that were published before we started validating this). - num_no_build -> Varchar, - /// The declared Rust Edition required to compile this version of the crate. - edition -> Nullable, - /// Value of the `description` field in the `Cargo.toml` file of this version. - description -> Nullable, - /// Value of the `homepage` field in the `Cargo.toml` file of this version. - homepage -> Nullable, - /// Value of the `documentation` field in the `Cargo.toml` file of this version. - documentation -> Nullable, - /// Value of the `repository` field in the `Cargo.toml` file of this version. - repository -> Nullable, - /// The list of `categories` in the `Cargo.toml` file of this version. - categories -> Array>, - /// The list of `keywords` in the `Cargo.toml` file of this version. - keywords -> Array>, /// JSONB representation of the version number for sorting purposes. semver_ord -> Nullable, /// JSONB data containing JWT claims from the trusted publisher (e.g., GitHub Actions context like repository, run_id, sha) trustpub_data -> Nullable, - /// Source Lines of Code statistics for this version, stored as JSON with language breakdown and totals. - linecounts -> Nullable, + /// The `updated_at` column of the `versions` table. + /// + /// Its SQL type is `Timestamptz`. + /// + /// (Automatically generated by Diesel.) + updated_at -> Timestamptz, + /// message associated with a yanked version + yank_message -> Nullable, + /// The `yanked` column of the `versions` table. + /// + /// Its SQL type is `Bool`. + /// + /// (Automatically generated by Diesel.) + yanked -> Bool, } } @@ -1121,18 +1121,18 @@ diesel::table! { /// /// (Automatically generated by Diesel.) versions_published_by (version_id) { - /// The `version_id` column of the `versions_published_by` table. - /// - /// Its SQL type is `Int4`. - /// - /// (Automatically generated by Diesel.) - version_id -> Int4, /// The `email` column of the `versions_published_by` table. /// /// Its SQL type is `Varchar`. /// /// (Automatically generated by Diesel.) email -> Varchar, + /// The `version_id` column of the `versions_published_by` table. + /// + /// Its SQL type is `Int4`. + /// + /// (Automatically generated by Diesel.) + version_id -> Int4, } } diff --git a/diesel.toml b/diesel.toml index 105b97e2810..eff8afbe67b 100644 --- a/diesel.toml +++ b/diesel.toml @@ -4,3 +4,4 @@ file = "crates/crates_io_database/src/schema.rs" with_docs = true patch_file = "crates/crates_io_database/src/schema.patch" +column_sorting = "name"