Repository: juspay/hyperswitch
File: crates/diesel_models/src/schema.rs (Rust)

Code before:
        merchant_id -> Varchar,
        #[max_length = 64]
        payment_id -> Varchar,
        amount -> Int8,
        created_at -> Timestamp,
        modified_at -> Timestamp,
        #[max_length = 64]
        status -> Varchar,
        #[max_length = 255]
        error_code -> Nullable<Varchar>,
        error_message -> Nullable<Text>,
        #[max_length = 64]
        connector_authorization_id -> Nullable<Varchar>,
        previously_authorized_amount -> Int8,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use crate::enums::diesel_exports::*;

    invoices (invoice_id) {
        #[max_length = 255]
        invoice_id -> Varchar,
        #[max_length = 255]
        subscription_id -> Nullable<Varchar>,
        #[max_length = 255]
        connector_subscription_id -> Nullable<Varchar>,
        #[max_length = 255]
        merchant_id -> Varchar,
        #[max_length = 255]
        profile_id -> Varchar,
        #[max_length = 255]
        merchant_connector_id -> Varchar,
        #[max_length = 255]
        payment_intent_id -> Varchar,
        #[max_length = 128]
        payment_method_id -> Nullable<Varchar>,
        #[max_length = 255]
        customer_id -> Varchar,
        amount -> Int4,
        #[max_length = 3]
        currency -> Varchar,
        #[max_length = 50]
        status -> Varchar,
        #[max_length = 100]
        provider_name -> Varchar,
        metadata -> Nullable<Jsonb>,
        created_at -> Timestamp,
        modified_at -> Timestamp,
    }

Review comment (suggestion):
```suggestion
        subscription_id -> Varchar,
```
Let's make it mandatory so that no invoice is created without a subscription id

Code after:
        id -> Varchar,
        #[max_length = 64]
        session_id -> Nullable<Varchar>,
        #[max_length = 64]
        user_id -> Nullable<Varchar>,
        #[max_length = 64]
        merchant_id -> Nullable<Varchar>,
        #[max_length = 64]
        profile_id -> Nullable<Varchar>,
        #[max_length = 64]
        org_id -> Nullable<Varchar>,
        #[max_length = 64]
        role_id -> Nullable<Varchar>,
        user_query -> Nullable<Bytea>,
        response -> Nullable<Bytea>,
        database_query -> Nullable<Text>,
        #[max_length = 64]
        interaction_status -> Nullable<Varchar>,
        created_at -> Timestamp,
    }
}

diesel::table! {
    use diesel::sql_types::*;
    use crate::enums::diesel_exports::*;

    hyperswitch_ai_interaction_default (id, created_at) {
        #[max_length = 64]
        id -> Varchar,
        #[max_length = 64]
        session_id -> Nullable<Varchar>,
        #[max_length = 64]
        user_id -> Nullable<Varchar>,
        #[max_length = 64]
        merchant_id -> Nullable<Varchar>,
        #[max_length = 64]
        profile_id -> Nullable<Varchar>,
        #[max_length = 64]
        org_id -> Nullable<Varchar>,
        #[max_length = 64]
        role_id -> Nullable<Varchar>,
        user_query -> Nullable<Bytea>,
        response -> Nullable<Bytea>,
        database_query -> Nullable<Text>,
        #[max_length = 64]
        interaction_status -> Nullable<Varchar>,
        created_at -> Timestamp,
    }
}

diesel::table! {