// @generated automatically by Diesel CLI.

/// A module containing custom SQL type definitions
///
/// (Automatically generated by Diesel.)
pub mod sql_types {
    /// The `ltree` SQL type
    ///
    /// (Automatically generated by Diesel.)
    #[derive(diesel::sql_types::SqlType)]
    #[diesel(postgres_type(name = "ltree"))]
    pub struct Ltree;
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `api_tokens` table.
    ///
    /// (Automatically generated by Diesel.)
    api_tokens (id) {
        /// NULL or an array of crate scope patterns (see RFC #2947)
        crate_scopes -> Nullable<Array<Text>>,
        /// The `created_at` column of the `api_tokens` table.
        ///
        /// Its SQL type is `Timestamptz`.
        ///
        /// (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<Array<Text>>,
        /// The `expired_at` column of the `api_tokens` table.
        ///
        /// Its SQL type is `Nullable<Timestamptz>`.
        ///
        /// (Automatically generated by Diesel.)
        expired_at -> Nullable<Timestamptz>,
        /// timestamp of when the user was informed about their token's impending expiration
        expiry_notification_at -> Nullable<Timestamptz>,
        /// The `id` column of the `api_tokens` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        id -> Int4,
        /// The `last_used_at` column of the `api_tokens` table.
        ///
        /// Its SQL type is `Nullable<Timestamptz>`.
        ///
        /// (Automatically generated by Diesel.)
        last_used_at -> Nullable<Timestamptz>,
        /// The `name` column of the `api_tokens` table.
        ///
        /// Its SQL type is `Varchar`.
        ///
        /// (Automatically generated by Diesel.)
        name -> Varchar,
        /// The `revoked` column of the `api_tokens` table.
        ///
        /// Its SQL type is `Bool`.
        ///
        /// (Automatically generated by Diesel.)
        revoked -> Bool,
        /// The `token` column of the `api_tokens` table.
        ///
        /// Its SQL type is `Bytea`.
        ///
        /// (Automatically generated by Diesel.)
        token -> Bytea,
        /// The `user_id` column of the `api_tokens` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        user_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `background_jobs` table.
    ///
    /// (Automatically generated by Diesel.)
    background_jobs (id) {
        /// The `created_at` column of the `background_jobs` table.
        ///
        /// Its SQL type is `Timestamptz`.
        ///
        /// (Automatically generated by Diesel.)
        created_at -> Timestamptz,
        /// The `data` column of the `background_jobs` table.
        ///
        /// Its SQL type is `Jsonb`.
        ///
        /// (Automatically generated by Diesel.)
        data -> Jsonb,
        /// 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.
        ///
        /// Its SQL type is `Text`.
        ///
        /// (Automatically generated by Diesel.)
        job_type -> Text,
        /// The `last_retry` column of the `background_jobs` table.
        ///
        /// Its SQL type is `Timestamptz`.
        ///
        /// (Automatically generated by Diesel.)
        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,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;
    use super::sql_types::Ltree;

    /// Representation of the `categories` table.
    ///
    /// (Automatically generated by Diesel.)
    categories (id) {
        /// The `category` column of the `categories` table.
        ///
        /// Its SQL type is `Varchar`.
        ///
        /// (Automatically generated by Diesel.)
        category -> Varchar,
        /// The `crates_cnt` 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.
        ///
        /// 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 `id` column of the `categories` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        id -> Int4,
        /// The `slug` column of the `categories` table.
        ///
        /// Its SQL type is `Varchar`.
        ///
        /// (Automatically generated by Diesel.)
        slug -> Varchar,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Queue for batching CloudFront CDN invalidation requests
    cloudfront_invalidation_queue (id) {
        /// Timestamp when the path was queued for invalidation
        created_at -> Timestamptz,
        /// CloudFront distribution to invalidate: "index" for index.crates.io, "static" for static.crates.io
        distribution -> Text,
        /// Unique identifier for each queued invalidation path
        id -> Int8,
        /// CloudFront path to invalidate (e.g. /crates/serde/serde-1.0.0.crate)
        path -> Text,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Number of downloads per crate. This was extracted from the `crates` table for performance reasons.
    crate_downloads (crate_id) {
        /// Reference to the crate that this row belongs to.
        crate_id -> Int4,
        /// The total number of downloads for this crate.
        downloads -> Int8,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `crate_owner_invitations` table.
    ///
    /// (Automatically generated by Diesel.)
    crate_owner_invitations (invited_user_id, crate_id) {
        /// The `crate_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.
        ///
        /// Its SQL type is `Timestamptz`.
        ///
        /// (Automatically generated by Diesel.)
        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.)
        invited_by_user_id -> Int4,
        /// The `invited_user_id` column of the `crate_owner_invitations` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        invited_user_id -> Int4,
        /// The `token` column of the `crate_owner_invitations` table.
        ///
        /// Its SQL type is `Text`.
        ///
        /// (Automatically generated by Diesel.)
        token -> Text,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `crate_owners` table.
    ///
    /// (Automatically generated by Diesel.)
    crate_owners (crate_id, owner_id, owner_kind) {
        /// The `crate_id` column of the `crate_owners` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        crate_id -> Int4,
        /// The `created_at` column of the `crate_owners` table.
        ///
        /// Its SQL type is `Timestamptz`.
        ///
        /// (Automatically generated by Diesel.)
        created_at -> Timestamptz,
        /// The `created_by` column of the `crate_owners` table.
        ///
        /// Its SQL type is `Nullable<Int4>`.
        ///
        /// (Automatically generated by Diesel.)
        created_by -> Nullable<Int4>,
        /// The `deleted` column of the `crate_owners` table.
        ///
        /// Its SQL type is `Bool`.
        ///
        /// (Automatically generated by Diesel.)
        deleted -> Bool,
        /// The `email_notifications` column of the `crate_owners` table.
        ///
        /// Its SQL type is `Bool`.
        ///
        /// (Automatically generated by Diesel.)
        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 `updated_at` column of the `crate_owners` table.
        ///
        /// Its SQL type is `Timestamptz`.
        ///
        /// (Automatically generated by Diesel.)
        updated_at -> Timestamptz,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `crates` table.
    ///
    /// (Automatically generated by Diesel.)
    crates (id) {
        /// The `created_at` column of the `crates` table.
        ///
        /// Its SQL type is `Timestamptz`.
        ///
        /// (Automatically generated by Diesel.)
        created_at -> Timestamptz,
        /// The `description` column of the `crates` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        description -> Nullable<Varchar>,
        /// The `documentation` column of the `crates` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        documentation -> Nullable<Varchar>,
        /// The `homepage` column of the `crates` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        homepage -> Nullable<Varchar>,
        /// The `id` column of the `crates` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        id -> Int4,
        /// The `max_features` column of the `crates` table.
        ///
        /// Its SQL type is `Nullable<Int2>`.
        ///
        /// (Automatically generated by Diesel.)
        max_features -> Nullable<Int2>,
        /// The `max_upload_size` column of the `crates` table.
        ///
        /// Its SQL type is `Nullable<Int4>`.
        ///
        /// (Automatically generated by Diesel.)
        max_upload_size -> Nullable<Int4>,
        /// 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<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        readme -> Nullable<Varchar>,
        /// The `repository` column of the `crates` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        repository -> Nullable<Varchar>,
        /// The `textsearchable_index_col` column of the `crates` table.
        ///
        /// Its SQL type is `Tsvector`.
        ///
        /// (Automatically generated by Diesel.)
        textsearchable_index_col -> Tsvector,
        /// When true, this crate can only be published via Trusted Publishing, not with API tokens
        trustpub_only -> Bool,
        /// The `updated_at` column of the `crates` table.
        ///
        /// Its SQL type is `Timestamptz`.
        ///
        /// (Automatically generated by Diesel.)
        updated_at -> Timestamptz,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `crates_categories` table.
    ///
    /// (Automatically generated by Diesel.)
    crates_categories (crate_id, category_id) {
        /// The `category_id` column of the `crates_categories` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        category_id -> Int4,
        /// The `crate_id` column of the `crates_categories` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        crate_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `crates_keywords` table.
    ///
    /// (Automatically generated by Diesel.)
    crates_keywords (crate_id, keyword_id) {
        /// The `crate_id` column of the `crates_keywords` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        crate_id -> Int4,
        /// The `keyword_id` column of the `crates_keywords` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        keyword_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// A mapping from crates to the versions that the frontend will display by default.
    default_versions (crate_id) {
        /// Reference to the crate in the `crates` table.
        crate_id -> Int4,
        /// The total number of versions.
        num_versions -> Nullable<Int4>,
        /// Reference to the version in the `versions` table.
        version_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Crates that have been deleted by users
    deleted_crates (id) {
        /// 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<Int4>,
        /// Unique identifier of the `deleted_crates` row
        id -> Int4,
        /// Optional message left by the user who deleted the crate
        message -> Nullable<Varchar>,
        /// Name of the deleted crate (use `canon_crate_name()` for normalization, if needed)
        name -> Varchar,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `dependencies` table.
    ///
    /// (Automatically generated by Diesel.)
    dependencies (id) {
        /// The `crate_id` column of the `dependencies` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        crate_id -> Int4,
        /// The `default_features` column of the `dependencies` table.
        ///
        /// Its SQL type is `Bool`.
        ///
        /// (Automatically generated by Diesel.)
        default_features -> Bool,
        /// The `explicit_name` column of the `dependencies` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        explicit_name -> Nullable<Varchar>,
        /// The `features` column of the `dependencies` table.
        ///
        /// Its SQL type is `Array<Nullable<Text>>`.
        ///
        /// (Automatically generated by Diesel.)
        features -> Array<Text>,
        /// The `id` column of the `dependencies` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        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.)
        optional -> Bool,
        /// The `req` column of the `dependencies` table.
        ///
        /// Its SQL type is `Varchar`.
        ///
        /// (Automatically generated by Diesel.)
        req -> Varchar,
        /// The `target` column of the `dependencies` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        target -> Nullable<Varchar>,
        /// The `version_id` column of the `dependencies` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        version_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `emails` table.
    ///
    /// (Automatically generated by Diesel.)
    emails (id) {
        /// The `email` column of the `emails` table.
        ///
        /// Its SQL type is `Varchar`.
        ///
        /// (Automatically generated by Diesel.)
        email -> Varchar,
        /// The `id` column of the `emails` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        id -> Int4,
        /// The `token` column of the `emails` table.
        ///
        /// Its SQL type is `Text`.
        ///
        /// (Automatically generated by Diesel.)
        token -> Text,
        /// The `token_generated_at` column of the `emails` table.
        ///
        /// Its SQL type is `Nullable<Timestamptz>`.
        ///
        /// (Automatically generated by Diesel.)
        token_generated_at -> Nullable<Timestamptz>,
        /// 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,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `follows` table.
    ///
    /// (Automatically generated by Diesel.)
    follows (user_id, crate_id) {
        /// The `crate_id` column of the `follows` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        crate_id -> Int4,
        /// The `user_id` column of the `follows` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        user_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `keywords` table.
    ///
    /// (Automatically generated by Diesel.)
    keywords (id) {
        /// The `crates_cnt` 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.
        ///
        /// Its SQL type is `Timestamptz`.
        ///
        /// (Automatically generated by Diesel.)
        created_at -> Timestamptz,
        /// The `id` column of the `keywords` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        id -> Int4,
        /// The `keyword` column of the `keywords` table.
        ///
        /// Its SQL type is `Text`.
        ///
        /// (Automatically generated by Diesel.)
        keyword -> Text,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `metadata` table.
    ///
    /// (Automatically generated by Diesel.)
    metadata (total_downloads) {
        /// The `total_downloads` column of the `metadata` table.
        ///
        /// Its SQL type is `Int8`.
        ///
        /// (Automatically generated by Diesel.)
        total_downloads -> Int8,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// GitHub-specific account information associated with a crates.io account
    oauth_github (account_id) {
        /// GitHub ID returned from the oAuth response
        account_id -> Int8,
        /// GitHub avatar URL
        avatar -> Nullable<Varchar>,
        /// Encrypted GitHub access token
        encrypted_token -> Bytea,
        /// The last time we verified with GitHub what the GitHub username for this user was, and whether the account was valid
        last_sync -> Timestamptz,
        /// GitHub username
        login -> Varchar,
        /// Crates.io user ID foreign key
        user_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// List of all processed CDN log files, used to avoid processing the same file multiple times.
    processed_log_files (path) {
        /// Path of the log file inside the S3 bucket
        path -> Varchar,
        /// Time when the log file was processed
        time -> Timestamptz,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `publish_limit_buckets` table.
    ///
    /// (Automatically generated by Diesel.)
    publish_limit_buckets (user_id, action) {
        /// The `action` column of the `publish_limit_buckets` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        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 `tokens` column of the `publish_limit_buckets` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        tokens -> Int4,
        /// The `user_id` column of the `publish_limit_buckets` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        user_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `publish_rate_overrides` table.
    ///
    /// (Automatically generated by Diesel.)
    publish_rate_overrides (user_id, action) {
        /// The `action` column of the `publish_rate_overrides` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        action -> Int4,
        /// The `burst` column of the `publish_rate_overrides` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        burst -> Int4,
        /// The `expires_at` column of the `publish_rate_overrides` table.
        ///
        /// Its SQL type is `Nullable<Timestamptz>`.
        ///
        /// (Automatically generated by Diesel.)
        expires_at -> Nullable<Timestamptz>,
        /// The `user_id` column of the `publish_rate_overrides` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        user_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `readme_renderings` table.
    ///
    /// (Automatically generated by Diesel.)
    readme_renderings (version_id) {
        /// 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,
    }
}

diesel::table! {
    /// Representation of the `recent_crate_downloads` view.
    ///
    /// This data represents the downloads in the last 90 days.
    /// This view does not contain realtime data.
    /// It is refreshed by the `update-downloads` script.
    recent_crate_downloads (crate_id) {
        /// The `crate_id` column of the `recent_crate_downloads` view.
        ///
        /// Its SQL type is `Integer`.
        crate_id -> Integer,
        /// The `downloads` column of the `recent_crate_downloads` table.
        ///
        /// Its SQL type is `BigInt`.
        downloads -> BigInt,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `reserved_crate_names` table.
    ///
    /// (Automatically generated by Diesel.)
    reserved_crate_names (name) {
        /// The `name` column of the `reserved_crate_names` table.
        ///
        /// Its SQL type is `Text`.
        ///
        /// (Automatically generated by Diesel.)
        name -> Text,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Usernames that may not be used for crates.io accounts.
    reserved_usernames (username) {
        /// The reserved username. Matching is case-insensitive and treats `-` and `_` as equivalent (see `canon_username()`).
        username -> Text,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Precomputed reverse-dependency edges (target crate <- dependent crate's default version). Derived cache table maintained by database triggers.
    reverse_dependencies (target_crate_id, dependent_crate_id) {
        /// The `dependencies` row used to hydrate the response.
        dependency_id -> Int4,
        /// The crate whose default version depends on the target crate.
        dependent_crate_id -> Int4,
        /// The dependent crate's total downloads, used for ordering the reverse dependencies.
        dependent_downloads -> Int8,
        /// The crate that is being depended upon.
        target_crate_id -> Int4,
        /// The dependent crate's default version.
        version_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `teams` table.
    ///
    /// (Automatically generated by Diesel.)
    teams (id) {
        /// The `avatar` column of the `teams` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        avatar -> Nullable<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 `id` column of the `teams` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        id -> Int4,
        /// Example: `github:foo:bar` means the `bar` team of the `foo` GitHub organization.
        login -> Varchar,
        /// The `name` column of the `teams` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        name -> Nullable<Varchar>,
        /// 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,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Trusted Publisher configuration for GitHub Actions
    trustpub_configs_github (id) {
        /// 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<Varchar>,
        /// 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 workflow file inside the repository that will be used to publish the crate
        workflow_filename -> Varchar,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Trusted Publisher configuration for GitLab CI
    trustpub_configs_gitlab (id) {
        /// 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<Varchar>,
        /// 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
        namespace_id -> Nullable<Varchar>,
        /// Name of the GitLab project that this configuration is for
        project -> Varchar,
        /// Path to the CI/CD configuration file that will be used to publish the crate
        workflow_filepath -> Varchar,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Temporary access tokens for Trusted Publishing
    trustpub_tokens (id) {
        /// Unique identifiers of the crates that can be published using this token
        crate_ids -> Array<Nullable<Int4>>,
        /// 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 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<Jsonb>,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// 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,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `users` table.
    ///
    /// (Automatically generated by Diesel.)
    users (id) {
        /// The `account_lock_reason` column of the `users` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        account_lock_reason -> Nullable<Varchar>,
        /// The `account_lock_until` column of the `users` table.
        ///
        /// Its SQL type is `Nullable<Timestamptz>`.
        ///
        /// (Automatically generated by Diesel.)
        account_lock_until -> Nullable<Timestamptz>,
        /// The time the user was created.
        created_at -> Nullable<Timestamptz>,
        /// The `gh_id` column of the `users` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        gh_id -> Int4,
        /// The `gh_login` column of the `users` table.
        ///
        /// Its SQL type is `Varchar`.
        ///
        /// (Automatically generated by Diesel.)
        gh_login -> Varchar,
        /// The `id` column of the `users` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        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<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        name -> Nullable<Varchar>,
        /// Whether or not the user wants to receive notifications when a package they own is published
        publish_notifications -> Bool,
        /// Username associated with the user's crates.io account, independent of linked OAuth usernames.
        username -> Varchar,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `version_downloads` table.
    ///
    /// (Automatically generated by Diesel.)
    version_downloads (version_id, date) {
        /// The `counted` column of the `version_downloads` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        counted -> Int4,
        /// The `date` column of the `version_downloads` table.
        ///
        /// Its SQL type is `Date`.
        ///
        /// (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,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `version_owner_actions` table.
    ///
    /// (Automatically generated by Diesel.)
    version_owner_actions (id) {
        /// The `action` column of the `version_owner_actions` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        action -> Int4,
        /// The `api_token_id` column of the `version_owner_actions` table.
        ///
        /// Its SQL type is `Nullable<Int4>`.
        ///
        /// (Automatically generated by Diesel.)
        api_token_id -> Nullable<Int4>,
        /// The `id` column of the `version_owner_actions` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        id -> Int4,
        /// The `time` column of the `version_owner_actions` table.
        ///
        /// Its SQL type is `Timestamptz`.
        ///
        /// (Automatically generated by Diesel.)
        time -> Timestamptz,
        /// The `user_id` column of the `version_owner_actions` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        user_id -> Int4,
        /// The `version_id` column of the `version_owner_actions` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        version_id -> Int4,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `versions` table.
    ///
    /// (Automatically generated by Diesel.)
    versions (id) {
        /// 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<Array<Nullable<Text>>>,
        /// The list of `categories` in the `Cargo.toml` file of this version.
        categories -> Array<Nullable<Text>>,
        /// The `crate_id` column of the `versions` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        crate_id -> Int4,
        /// The `crate_size` column of the `versions` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        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<Text>,
        /// Value of the `documentation` field in the `Cargo.toml` file of this version.
        documentation -> Nullable<Text>,
        /// 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<Text>,
        /// The `features` column of the `versions` table.
        ///
        /// Its SQL type is `Jsonb`.
        ///
        /// (Automatically generated by Diesel.)
        features -> Jsonb,
        /// 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<Bool>,
        /// Value of the `homepage` field in the `Cargo.toml` file of this version.
        homepage -> Nullable<Text>,
        /// The `id` column of the `versions` table.
        ///
        /// Its SQL type is `Int4`.
        ///
        /// (Automatically generated by Diesel.)
        id -> Int4,
        /// The list of `keywords` in the `Cargo.toml` file of this version.
        keywords -> Array<Nullable<Text>>,
        /// The library target name for this version (the Rust identifier used in `use` statements), or NULL if the version has no library target or has not been analyzed yet.
        lib_name -> Nullable<Text>,
        /// The `license` column of the `versions` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        license -> Nullable<Varchar>,
        /// Source Lines of Code statistics for this version, stored as JSON with language breakdown and totals.
        linecounts -> Nullable<Jsonb>,
        /// The `links` column of the `versions` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        links -> Nullable<Varchar>,
        /// The `num` column of the `versions` table.
        ///
        /// Its SQL type is `Varchar`.
        ///
        /// (Automatically generated by Diesel.)
        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<Int4>`.
        ///
        /// (Automatically generated by Diesel.)
        published_by -> Nullable<Int4>,
        /// Value of the `repository` field in the `Cargo.toml` file of this version.
        repository -> Nullable<Text>,
        /// The `rust_version` column of the `versions` table.
        ///
        /// Its SQL type is `Nullable<Varchar>`.
        ///
        /// (Automatically generated by Diesel.)
        rust_version -> Nullable<Varchar>,
        /// Order-preserving bytea representation of the version number for sorting purposes.
        semver_ord_v2 -> Bytea,
        /// SHA256 checksum of the crate tarball, stored as 32 raw bytes.
        tar_sha256 -> Bytea,
        /// JSONB data containing JWT claims from the trusted publisher (e.g., GitHub Actions context like repository, run_id, sha)
        trustpub_data -> Nullable<Jsonb>,
        /// 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<Text>,
        /// The `yanked` column of the `versions` table.
        ///
        /// Its SQL type is `Bool`.
        ///
        /// (Automatically generated by Diesel.)
        yanked -> Bool,
        /// SHA256 checksum of the zip source archive manifest, or `NULL` if it has not been built yet.
        zip_json_sha256 -> Nullable<Bytea>,
        /// SHA256 checksum of the zip source archive, or `NULL` if it has not been built yet.
        zip_sha256 -> Nullable<Bytea>,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use diesel_full_text_search::Tsvector;

    /// Representation of the `versions_published_by` table.
    ///
    /// (Automatically generated by Diesel.)
    versions_published_by (version_id) {
        /// 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,
    }
}

diesel::joinable!(api_tokens -> users (user_id));
diesel::joinable!(crate_downloads -> crates (crate_id));
diesel::joinable!(crate_owner_invitations -> crates (crate_id));
diesel::joinable!(crate_owners -> crates (crate_id));
diesel::joinable!(crate_owners -> teams (owner_id));
diesel::joinable!(crate_owners -> users (owner_id));
diesel::joinable!(crates_categories -> categories (category_id));
diesel::joinable!(crates_categories -> crates (crate_id));
diesel::joinable!(crates_keywords -> crates (crate_id));
diesel::joinable!(crates_keywords -> keywords (keyword_id));
diesel::joinable!(default_versions -> crates (crate_id));
diesel::joinable!(default_versions -> versions (version_id));
diesel::joinable!(deleted_crates -> users (deleted_by));
diesel::joinable!(dependencies -> crates (crate_id));
diesel::joinable!(dependencies -> versions (version_id));
diesel::joinable!(emails -> users (user_id));
diesel::joinable!(follows -> crates (crate_id));
diesel::joinable!(follows -> users (user_id));
diesel::joinable!(oauth_github -> users (user_id));
diesel::joinable!(publish_limit_buckets -> users (user_id));
diesel::joinable!(publish_rate_overrides -> users (user_id));
diesel::joinable!(readme_renderings -> versions (version_id));
diesel::joinable!(recent_crate_downloads -> crates (crate_id));
diesel::joinable!(reverse_dependencies -> versions (version_id));
diesel::joinable!(trustpub_configs_github -> crates (crate_id));
diesel::joinable!(trustpub_configs_gitlab -> crates (crate_id));
diesel::joinable!(version_downloads -> versions (version_id));
diesel::joinable!(version_owner_actions -> api_tokens (api_token_id));
diesel::joinable!(version_owner_actions -> users (user_id));
diesel::joinable!(version_owner_actions -> versions (version_id));
diesel::joinable!(versions -> crates (crate_id));
diesel::joinable!(versions -> users (published_by));
diesel::joinable!(versions_published_by -> versions (version_id));

diesel::allow_tables_to_appear_in_same_query!(
    api_tokens,
    background_jobs,
    categories,
    cloudfront_invalidation_queue,
    crate_downloads,
    crate_owner_invitations,
    crate_owners,
    crates,
    crates_categories,
    crates_keywords,
    default_versions,
    deleted_crates,
    dependencies,
    emails,
    follows,
    keywords,
    metadata,
    oauth_github,
    processed_log_files,
    publish_limit_buckets,
    publish_rate_overrides,
    readme_renderings,
    recent_crate_downloads,
    reserved_crate_names,
    reserved_usernames,
    reverse_dependencies,
    teams,
    trustpub_configs_github,
    trustpub_configs_gitlab,
    trustpub_tokens,
    trustpub_used_jtis,
    users,
    version_downloads,
    version_owner_actions,
    versions,
    versions_published_by,
);
