Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
chore: create justfile for running commands for v1 and v2 migrations (#5325)
Hrithikesh23bfceb6c8d3
diff --git a/.github/workflows/migration-check.yaml b/.github/workflows/migration-check.yamlindex baab2b7bc9..c453469b90 100644--- a/.github/workflows/migration-check.yaml+++ b/.github/workflows/migration-check.yaml@@ -25,6 +25,9 @@ jobs:name: Verify consistency of migrations with `schema.rs` fileruns-on: ubuntu-latest+ env:+ DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres+services:postgres:image: postgres@@ -53,14 +56,22 @@ jobs:features: postgresargs: "--no-default-features"- - name: Verify `diesel migration run`+ - uses: baptiste0928/[email protected]+ with:+ crate: just++ - name: Verify `diesel migration run for v1`shell: bash- env:- DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres- run: make migrate locked-schema=yes+ run: just migrate run --locked-schema- - name: Verify `diesel migration redo`+ - name: Verify `diesel migration redo for v1`shell: bash- env:- DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres- run: make redo_migrate locked-schema=yes+ run: just migrate redo --locked-schema --all++ - name: Verify `diesel migration run for v2`+ shell: bash+ run: just migrate_v2 run --locked-schema++ - name: Verify `diesel migration redo for v2`+ shell: bash+ run: just migrate_v2 redo --locked-schema --alldiff --git a/.github/workflows/postman-collection-runner.yml b/.github/workflows/postman-collection-runner.ymlindex 0c2220d6e6..3877675963 100644--- a/.github/workflows/postman-collection-runner.yml+++ b/.github/workflows/postman-collection-runner.yml@@ -102,12 +102,17 @@ jobs:features: postgresargs: "--no-default-features"+ - uses: baptiste0928/[email protected]+ if: ${{ ((github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name)) || (github.event_name == 'merge_group')}}+ with:+ crate: just+- name: Diesel migration runif: ${{ ((github.event_name == 'pull_request') && (github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name)) || (github.event_name == 'merge_group')}}shell: bashenv:DATABASE_URL: postgres://db_user:db_pass@localhost:5432/hyperswitch_db- run: make migrate locked-schema=yes+ run: just migrate run --locked-schema- name: Install newman from forkrun: npm cidiff --git a/INSTALL_dependencies.sh b/INSTALL_dependencies.shindex cade0a4e02..871810ef32 100755--- a/INSTALL_dependencies.sh+++ b/INSTALL_dependencies.sh@@ -252,7 +252,7 @@ fi# run migrationsprint_info "Running migrations"-MIGRATION_CMD="make migrate database-url=postgres://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}"+MIGRATION_CMD="diesel migration --database-url=postgres://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME} run"if [[ -d "migrations" ]]; then$MIGRATION_CMDdiff --git a/Makefile b/Makefileindex 760f2d3fc6..4d12fdafb5 100644--- a/Makefile+++ b/Makefile@@ -113,37 +113,3 @@ precommit : fmt clippy testhack:cargo hack check --workspace --each-feature --all-targets--# Run database migrations using `diesel_cli`.-# Assumes `diesel_cli` is already installed.-#-# Usage :-# make migrate [database-url=<PSQL connection string>] [locked-schema=<yes|no>]--# This proceeds as follows:-# Creates a temporary migrations directory, cleans it up if it already exists-# Copies all migrations to the temporary migrations directory and runs migrations-# Cleans up migrations, removing tmp directory if empty, ignoring otherwise-migrate:- mkdir -p $(ROOT_DIR)/tmp/migrations- find $(ROOT_DIR)/tmp/migrations/ -mindepth 1 -delete-- cp -r $(ROOT_DIR)/migrations/. $(ROOT_DIR)/v2_migrations/. $(ROOT_DIR)/tmp/migrations/- diesel migration run --migration-dir=$(ROOT_DIR)/tmp/migrations \- $(if $(strip $(database-url)),--database-url="$(database-url)",) \- $(if $(strip $(call eq,$(locked-schema),yes)),--locked-schema,)-- rm -r $(ROOT_DIR)/tmp/migrations- rmdir $(ROOT_DIR)/tmp 2>/dev/null || true--redo_migrate:- mkdir -p $(ROOT_DIR)/tmp/migrations- find $(ROOT_DIR)/tmp/migrations/ -mindepth 1 -delete-- cp -r $(ROOT_DIR)/migrations/. $(ROOT_DIR)/v2_migrations/. $(ROOT_DIR)/tmp/migrations/- diesel migration redo --all --migration-dir=$(ROOT_DIR)/tmp/migrations \- $(if $(strip $(database-url)),--database-url="$(database-url)",) \- $(if $(strip $(call eq,$(locked-schema),yes)),--locked-schema,)-- rm -r $(ROOT_DIR)/tmp/migrations- rmdir $(ROOT_DIR)/tmp 2>/dev/null || truediff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rsindex 626de94710..40899ffcb8 100644--- a/crates/diesel_models/src/payment_attempt.rs+++ b/crates/diesel_models/src/payment_attempt.rs@@ -13,6 +13,7 @@ use crate::{)]#[diesel(table_name = payment_attempt, primary_key(attempt_id, merchant_id), check_for_backend(diesel::pg::Pg))]pub struct PaymentAttempt {+ pub id: Option<i32>,pub payment_id: String,pub merchant_id: String,pub attempt_id: String,diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rsindex 8deca44253..499d72a648 100644--- a/crates/diesel_models/src/payment_intent.rs+++ b/crates/diesel_models/src/payment_intent.rs@@ -9,6 +9,7 @@ use crate::{encryption::Encryption, enums as storage_enums, schema::payment_inte#[derive(Clone, Debug, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize)]#[diesel(table_name = payment_intent, primary_key(payment_id, merchant_id), check_for_backend(diesel::pg::Pg))]pub struct PaymentIntent {+ pub id: Option<i32>,pub payment_id: String,pub merchant_id: String,pub status: storage_enums::IntentStatus,diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex cd8ea4e1e8..d876c2101c 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -740,6 +740,7 @@ diesel::table! {use crate::enums::diesel_exports::*;payment_attempt (attempt_id, merchant_id) {+ id -> Nullable<Int4>,#[max_length = 64]payment_id -> Varchar,#[max_length = 64]@@ -830,6 +831,7 @@ diesel::table! {use crate::enums::diesel_exports::*;payment_intent (payment_id, merchant_id) {+ id -> Nullable<Int4>,#[max_length = 64]payment_id -> Varchar,#[max_length = 64]diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rsnew file mode 100644index 0000000000..cd8ea4e1e8--- /dev/null+++ b/crates/diesel_models/src/schema_v2.rs@@ -0,0 +1,1338 @@+// @generated automatically by Diesel CLI.++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ address (address_id) {+ id -> Nullable<Int4>,+ #[max_length = 64]+ address_id -> Varchar,+ #[max_length = 128]+ city -> Nullable<Varchar>,+ country -> Nullable<CountryAlpha2>,+ line1 -> Nullable<Bytea>,+ line2 -> Nullable<Bytea>,+ line3 -> Nullable<Bytea>,+ state -> Nullable<Bytea>,+ zip -> Nullable<Bytea>,+ first_name -> Nullable<Bytea>,+ last_name -> Nullable<Bytea>,+ phone_number -> Nullable<Bytea>,+ #[max_length = 8]+ country_code -> Nullable<Varchar>,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ #[max_length = 64]+ customer_id -> Nullable<Varchar>,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ payment_id -> Nullable<Varchar>,+ #[max_length = 32]+ updated_by -> Varchar,+ email -> Nullable<Bytea>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ api_keys (key_id) {+ #[max_length = 64]+ key_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ name -> Varchar,+ #[max_length = 256]+ description -> Nullable<Varchar>,+ #[max_length = 128]+ hashed_api_key -> Varchar,+ #[max_length = 16]+ prefix -> Varchar,+ created_at -> Timestamp,+ expires_at -> Nullable<Timestamp>,+ last_used -> Nullable<Timestamp>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ authentication (authentication_id) {+ #[max_length = 64]+ authentication_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ authentication_connector -> Varchar,+ #[max_length = 64]+ connector_authentication_id -> Nullable<Varchar>,+ authentication_data -> Nullable<Jsonb>,+ #[max_length = 64]+ payment_method_id -> Varchar,+ #[max_length = 64]+ authentication_type -> Nullable<Varchar>,+ #[max_length = 64]+ authentication_status -> Varchar,+ #[max_length = 64]+ authentication_lifecycle_status -> Varchar,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ error_message -> Nullable<Text>,+ #[max_length = 64]+ error_code -> Nullable<Varchar>,+ connector_metadata -> Nullable<Jsonb>,+ maximum_supported_version -> Nullable<Jsonb>,+ #[max_length = 64]+ threeds_server_transaction_id -> Nullable<Varchar>,+ #[max_length = 64]+ cavv -> Nullable<Varchar>,+ #[max_length = 64]+ authentication_flow_type -> Nullable<Varchar>,+ message_version -> Nullable<Jsonb>,+ #[max_length = 64]+ eci -> Nullable<Varchar>,+ #[max_length = 64]+ trans_status -> Nullable<Varchar>,+ #[max_length = 64]+ acquirer_bin -> Nullable<Varchar>,+ #[max_length = 64]+ acquirer_merchant_id -> Nullable<Varchar>,+ three_ds_method_data -> Nullable<Varchar>,+ three_ds_method_url -> Nullable<Varchar>,+ acs_url -> Nullable<Varchar>,+ challenge_request -> Nullable<Varchar>,+ acs_reference_number -> Nullable<Varchar>,+ acs_trans_id -> Nullable<Varchar>,+ acs_signed_content -> Nullable<Varchar>,+ #[max_length = 64]+ profile_id -> Varchar,+ #[max_length = 255]+ payment_id -> Nullable<Varchar>,+ #[max_length = 128]+ merchant_connector_id -> Varchar,+ #[max_length = 64]+ ds_trans_id -> Nullable<Varchar>,+ #[max_length = 128]+ directory_server_id -> Nullable<Varchar>,+ #[max_length = 64]+ acquirer_country_code -> Nullable<Varchar>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ blocklist (id) {+ id -> Int4,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ fingerprint_id -> Varchar,+ data_kind -> BlocklistDataKind,+ metadata -> Nullable<Jsonb>,+ created_at -> Timestamp,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ blocklist_fingerprint (id) {+ id -> Int4,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ fingerprint_id -> Varchar,+ data_kind -> BlocklistDataKind,+ encrypted_fingerprint -> Text,+ created_at -> Timestamp,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ blocklist_lookup (id) {+ id -> Int4,+ #[max_length = 64]+ merchant_id -> Varchar,+ fingerprint -> Text,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ business_profile (profile_id) {+ #[max_length = 64]+ profile_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ profile_name -> Varchar,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ return_url -> Nullable<Text>,+ enable_payment_response_hash -> Bool,+ #[max_length = 255]+ payment_response_hash_key -> Nullable<Varchar>,+ redirect_to_merchant_with_http_post -> Bool,+ webhook_details -> Nullable<Json>,+ metadata -> Nullable<Json>,+ routing_algorithm -> Nullable<Json>,+ intent_fulfillment_time -> Nullable<Int8>,+ frm_routing_algorithm -> Nullable<Jsonb>,+ payout_routing_algorithm -> Nullable<Jsonb>,+ is_recon_enabled -> Bool,+ applepay_verified_domains -> Nullable<Array<Nullable<Text>>>,+ payment_link_config -> Nullable<Jsonb>,+ session_expiry -> Nullable<Int8>,+ authentication_connector_details -> Nullable<Jsonb>,+ payout_link_config -> Nullable<Jsonb>,+ is_extended_card_info_enabled -> Nullable<Bool>,+ extended_card_info_config -> Nullable<Jsonb>,+ is_connector_agnostic_mit_enabled -> Nullable<Bool>,+ use_billing_as_payment_method_billing -> Nullable<Bool>,+ collect_shipping_details_from_wallet_connector -> Nullable<Bool>,+ collect_billing_details_from_wallet_connector -> Nullable<Bool>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ captures (capture_id) {+ #[max_length = 64]+ capture_id -> Varchar,+ #[max_length = 64]+ payment_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ status -> CaptureStatus,+ amount -> Int8,+ currency -> Nullable<Currency>,+ #[max_length = 255]+ connector -> Varchar,+ #[max_length = 255]+ error_message -> Nullable<Varchar>,+ #[max_length = 255]+ error_code -> Nullable<Varchar>,+ #[max_length = 255]+ error_reason -> Nullable<Varchar>,+ tax_amount -> Nullable<Int8>,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ #[max_length = 64]+ authorized_attempt_id -> Varchar,+ #[max_length = 128]+ connector_capture_id -> Nullable<Varchar>,+ capture_sequence -> Int2,+ #[max_length = 128]+ connector_response_reference_id -> Nullable<Varchar>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ cards_info (card_iin) {+ #[max_length = 16]+ card_iin -> Varchar,+ card_issuer -> Nullable<Text>,+ card_network -> Nullable<Text>,+ card_type -> Nullable<Text>,+ card_subtype -> Nullable<Text>,+ card_issuing_country -> Nullable<Text>,+ #[max_length = 32]+ bank_code_id -> Nullable<Varchar>,+ #[max_length = 32]+ bank_code -> Nullable<Varchar>,+ #[max_length = 32]+ country_code -> Nullable<Varchar>,+ date_created -> Timestamp,+ last_updated -> Nullable<Timestamp>,+ last_updated_provider -> Nullable<Text>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ configs (key) {+ id -> Int4,+ #[max_length = 255]+ key -> Varchar,+ config -> Text,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ customers (customer_id, merchant_id) {+ id -> Int4,+ #[max_length = 64]+ customer_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ name -> Nullable<Bytea>,+ email -> Nullable<Bytea>,+ phone -> Nullable<Bytea>,+ #[max_length = 8]+ phone_country_code -> Nullable<Varchar>,+ #[max_length = 255]+ description -> Nullable<Varchar>,+ created_at -> Timestamp,+ metadata -> Nullable<Json>,+ connector_customer -> Nullable<Jsonb>,+ modified_at -> Timestamp,+ #[max_length = 64]+ address_id -> Nullable<Varchar>,+ #[max_length = 64]+ default_payment_method_id -> Nullable<Varchar>,+ #[max_length = 64]+ updated_by -> Nullable<Varchar>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ dashboard_metadata (id) {+ id -> Int4,+ #[max_length = 64]+ user_id -> Nullable<Varchar>,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ org_id -> Varchar,+ data_key -> DashboardMetadata,+ data_value -> Json,+ #[max_length = 64]+ created_by -> Varchar,+ created_at -> Timestamp,+ #[max_length = 64]+ last_modified_by -> Varchar,+ last_modified_at -> Timestamp,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ dispute (id) {+ id -> Int4,+ #[max_length = 64]+ dispute_id -> Varchar,+ #[max_length = 255]+ amount -> Varchar,+ #[max_length = 255]+ currency -> Varchar,+ dispute_stage -> DisputeStage,+ dispute_status -> DisputeStatus,+ #[max_length = 64]+ payment_id -> Varchar,+ #[max_length = 64]+ attempt_id -> Varchar,+ #[max_length = 255]+ merchant_id -> Varchar,+ #[max_length = 255]+ connector_status -> Varchar,+ #[max_length = 255]+ connector_dispute_id -> Varchar,+ #[max_length = 255]+ connector_reason -> Nullable<Varchar>,+ #[max_length = 255]+ connector_reason_code -> Nullable<Varchar>,+ challenge_required_by -> Nullable<Timestamp>,+ connector_created_at -> Nullable<Timestamp>,+ connector_updated_at -> Nullable<Timestamp>,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ #[max_length = 255]+ connector -> Varchar,+ evidence -> Jsonb,+ #[max_length = 64]+ profile_id -> Nullable<Varchar>,+ #[max_length = 32]+ merchant_connector_id -> Nullable<Varchar>,+ dispute_amount -> Int8,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ events (event_id) {+ #[max_length = 64]+ event_id -> Varchar,+ event_type -> EventType,+ event_class -> EventClass,+ is_webhook_notified -> Bool,+ #[max_length = 64]+ primary_object_id -> Varchar,+ primary_object_type -> EventObjectType,+ created_at -> Timestamp,+ #[max_length = 64]+ merchant_id -> Nullable<Varchar>,+ #[max_length = 64]+ business_profile_id -> Nullable<Varchar>,+ primary_object_created_at -> Nullable<Timestamp>,+ #[max_length = 64]+ idempotent_event_id -> Nullable<Varchar>,+ #[max_length = 64]+ initial_attempt_id -> Nullable<Varchar>,+ request -> Nullable<Bytea>,+ response -> Nullable<Bytea>,+ delivery_attempt -> Nullable<WebhookDeliveryAttempt>,+ metadata -> Nullable<Jsonb>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ file_metadata (file_id, merchant_id) {+ #[max_length = 64]+ file_id -> Varchar,+ #[max_length = 255]+ merchant_id -> Varchar,+ #[max_length = 255]+ file_name -> Nullable<Varchar>,+ file_size -> Int4,+ #[max_length = 255]+ file_type -> Varchar,+ #[max_length = 255]+ provider_file_id -> Nullable<Varchar>,+ #[max_length = 255]+ file_upload_provider -> Nullable<Varchar>,+ available -> Bool,+ created_at -> Timestamp,+ #[max_length = 255]+ connector_label -> Nullable<Varchar>,+ #[max_length = 64]+ profile_id -> Nullable<Varchar>,+ #[max_length = 32]+ merchant_connector_id -> Nullable<Varchar>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ fraud_check (frm_id, attempt_id, payment_id, merchant_id) {+ #[max_length = 64]+ frm_id -> Varchar,+ #[max_length = 64]+ payment_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ attempt_id -> Varchar,+ created_at -> Timestamp,+ #[max_length = 255]+ frm_name -> Varchar,+ #[max_length = 255]+ frm_transaction_id -> Nullable<Varchar>,+ frm_transaction_type -> FraudCheckType,+ frm_status -> FraudCheckStatus,+ frm_score -> Nullable<Int4>,+ frm_reason -> Nullable<Jsonb>,+ #[max_length = 255]+ frm_error -> Nullable<Varchar>,+ payment_details -> Nullable<Jsonb>,+ metadata -> Nullable<Jsonb>,+ modified_at -> Timestamp,+ #[max_length = 64]+ last_step -> Varchar,+ payment_capture_method -> Nullable<CaptureMethod>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ gateway_status_map (connector, flow, sub_flow, code, message) {+ #[max_length = 64]+ connector -> Varchar,+ #[max_length = 64]+ flow -> Varchar,+ #[max_length = 64]+ sub_flow -> Varchar,+ #[max_length = 255]+ code -> Varchar,+ #[max_length = 1024]+ message -> Varchar,+ #[max_length = 64]+ status -> Varchar,+ #[max_length = 64]+ router_error -> Nullable<Varchar>,+ #[max_length = 64]+ decision -> Varchar,+ created_at -> Timestamp,+ last_modified -> Timestamp,+ step_up_possible -> Bool,+ #[max_length = 255]+ unified_code -> Nullable<Varchar>,+ #[max_length = 1024]+ unified_message -> Nullable<Varchar>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ generic_link (link_id) {+ #[max_length = 64]+ link_id -> Varchar,+ #[max_length = 64]+ primary_reference -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ created_at -> Timestamp,+ last_modified_at -> Timestamp,+ expiry -> Timestamp,+ link_data -> Jsonb,+ link_status -> Jsonb,+ link_type -> GenericLinkType,+ url -> Text,+ return_url -> Nullable<Text>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ incremental_authorization (authorization_id, merchant_id) {+ #[max_length = 64]+ authorization_id -> Varchar,+ #[max_length = 64]+ 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::*;++ locker_mock_up (id) {+ id -> Int4,+ #[max_length = 255]+ card_id -> Varchar,+ #[max_length = 255]+ external_id -> Varchar,+ #[max_length = 255]+ card_fingerprint -> Varchar,+ #[max_length = 255]+ card_global_fingerprint -> Varchar,+ #[max_length = 255]+ merchant_id -> Varchar,+ #[max_length = 255]+ card_number -> Varchar,+ #[max_length = 255]+ card_exp_year -> Varchar,+ #[max_length = 255]+ card_exp_month -> Varchar,+ #[max_length = 255]+ name_on_card -> Nullable<Varchar>,+ #[max_length = 255]+ nickname -> Nullable<Varchar>,+ #[max_length = 255]+ customer_id -> Nullable<Varchar>,+ duplicate -> Nullable<Bool>,+ #[max_length = 8]+ card_cvc -> Nullable<Varchar>,+ #[max_length = 64]+ payment_method_id -> Nullable<Varchar>,+ enc_card_data -> Nullable<Text>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ mandate (id) {+ id -> Int4,+ #[max_length = 64]+ mandate_id -> Varchar,+ #[max_length = 64]+ customer_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ payment_method_id -> Varchar,+ mandate_status -> MandateStatus,+ mandate_type -> MandateType,+ customer_accepted_at -> Nullable<Timestamp>,+ #[max_length = 64]+ customer_ip_address -> Nullable<Varchar>,+ #[max_length = 255]+ customer_user_agent -> Nullable<Varchar>,+ #[max_length = 128]+ network_transaction_id -> Nullable<Varchar>,+ #[max_length = 64]+ previous_attempt_id -> Nullable<Varchar>,+ created_at -> Timestamp,+ mandate_amount -> Nullable<Int8>,+ mandate_currency -> Nullable<Currency>,+ amount_captured -> Nullable<Int8>,+ #[max_length = 64]+ connector -> Varchar,+ #[max_length = 128]+ connector_mandate_id -> Nullable<Varchar>,+ start_date -> Nullable<Timestamp>,+ end_date -> Nullable<Timestamp>,+ metadata -> Nullable<Jsonb>,+ connector_mandate_ids -> Nullable<Jsonb>,+ #[max_length = 64]+ original_payment_id -> Nullable<Varchar>,+ #[max_length = 32]+ merchant_connector_id -> Nullable<Varchar>,+ #[max_length = 64]+ updated_by -> Nullable<Varchar>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ merchant_account (id) {+ id -> Int4,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 255]+ return_url -> Nullable<Varchar>,+ enable_payment_response_hash -> Bool,+ #[max_length = 255]+ payment_response_hash_key -> Nullable<Varchar>,+ redirect_to_merchant_with_http_post -> Bool,+ merchant_name -> Nullable<Bytea>,+ merchant_details -> Nullable<Bytea>,+ webhook_details -> Nullable<Json>,+ sub_merchants_enabled -> Nullable<Bool>,+ #[max_length = 64]+ parent_merchant_id -> Nullable<Varchar>,+ #[max_length = 128]+ publishable_key -> Nullable<Varchar>,+ storage_scheme -> MerchantStorageScheme,+ #[max_length = 64]+ locker_id -> Nullable<Varchar>,+ metadata -> Nullable<Jsonb>,+ routing_algorithm -> Nullable<Json>,+ primary_business_details -> Json,+ intent_fulfillment_time -> Nullable<Int8>,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ frm_routing_algorithm -> Nullable<Jsonb>,+ payout_routing_algorithm -> Nullable<Jsonb>,+ #[max_length = 32]+ organization_id -> Varchar,+ is_recon_enabled -> Bool,+ #[max_length = 64]+ default_profile -> Nullable<Varchar>,+ recon_status -> ReconStatus,+ payment_link_config -> Nullable<Jsonb>,+ pm_collect_link_config -> Nullable<Jsonb>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ merchant_connector_account (id) {+ id -> Int4,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ connector_name -> Varchar,+ connector_account_details -> Bytea,+ test_mode -> Nullable<Bool>,+ disabled -> Nullable<Bool>,+ #[max_length = 128]+ merchant_connector_id -> Varchar,+ payment_methods_enabled -> Nullable<Array<Nullable<Json>>>,+ connector_type -> ConnectorType,+ metadata -> Nullable<Jsonb>,+ #[max_length = 255]+ connector_label -> Nullable<Varchar>,+ business_country -> Nullable<CountryAlpha2>,+ #[max_length = 255]+ business_label -> Nullable<Varchar>,+ #[max_length = 64]+ business_sub_label -> Nullable<Varchar>,+ frm_configs -> Nullable<Jsonb>,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ connector_webhook_details -> Nullable<Jsonb>,+ frm_config -> Nullable<Array<Nullable<Jsonb>>>,+ #[max_length = 64]+ profile_id -> Nullable<Varchar>,+ applepay_verified_domains -> Nullable<Array<Nullable<Text>>>,+ pm_auth_config -> Nullable<Jsonb>,+ status -> ConnectorStatus,+ additional_merchant_data -> Nullable<Bytea>,+ connector_wallets_details -> Nullable<Bytea>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ merchant_key_store (merchant_id) {+ #[max_length = 64]+ merchant_id -> Varchar,+ key -> Bytea,+ created_at -> Timestamp,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ organization (org_id) {+ #[max_length = 32]+ org_id -> Varchar,+ org_name -> Nullable<Text>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ payment_attempt (attempt_id, merchant_id) {+ #[max_length = 64]+ payment_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ attempt_id -> Varchar,+ status -> AttemptStatus,+ amount -> Int8,+ currency -> Nullable<Currency>,+ save_to_locker -> Nullable<Bool>,+ #[max_length = 64]+ connector -> Nullable<Varchar>,+ error_message -> Nullable<Text>,+ offer_amount -> Nullable<Int8>,+ surcharge_amount -> Nullable<Int8>,+ tax_amount -> Nullable<Int8>,+ #[max_length = 64]+ payment_method_id -> Nullable<Varchar>,+ payment_method -> Nullable<Varchar>,+ #[max_length = 128]+ connector_transaction_id -> Nullable<Varchar>,+ capture_method -> Nullable<CaptureMethod>,+ capture_on -> Nullable<Timestamp>,+ confirm -> Bool,+ authentication_type -> Nullable<AuthenticationType>,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ last_synced -> Nullable<Timestamp>,+ #[max_length = 255]+ cancellation_reason -> Nullable<Varchar>,+ amount_to_capture -> Nullable<Int8>,+ #[max_length = 64]+ mandate_id -> Nullable<Varchar>,+ browser_info -> Nullable<Jsonb>,+ #[max_length = 255]+ error_code -> Nullable<Varchar>,+ #[max_length = 128]+ payment_token -> Nullable<Varchar>,+ connector_metadata -> Nullable<Jsonb>,+ #[max_length = 50]+ payment_experience -> Nullable<Varchar>,+ #[max_length = 64]+ payment_method_type -> Nullable<Varchar>,+ payment_method_data -> Nullable<Jsonb>,+ #[max_length = 64]+ business_sub_label -> Nullable<Varchar>,+ straight_through_algorithm -> Nullable<Jsonb>,+ preprocessing_step_id -> Nullable<Varchar>,+ mandate_details -> Nullable<Jsonb>,+ error_reason -> Nullable<Text>,+ multiple_capture_count -> Nullable<Int2>,+ #[max_length = 128]+ connector_response_reference_id -> Nullable<Varchar>,+ amount_capturable -> Int8,+ #[max_length = 32]+ updated_by -> Varchar,+ #[max_length = 32]+ merchant_connector_id -> Nullable<Varchar>,+ authentication_data -> Nullable<Json>,+ encoded_data -> Nullable<Text>,+ #[max_length = 255]+ unified_code -> Nullable<Varchar>,+ #[max_length = 1024]+ unified_message -> Nullable<Varchar>,+ net_amount -> Nullable<Int8>,+ external_three_ds_authentication_attempted -> Nullable<Bool>,+ #[max_length = 64]+ authentication_connector -> Nullable<Varchar>,+ #[max_length = 64]+ authentication_id -> Nullable<Varchar>,+ mandate_data -> Nullable<Jsonb>,+ #[max_length = 64]+ fingerprint_id -> Nullable<Varchar>,+ #[max_length = 64]+ payment_method_billing_address_id -> Nullable<Varchar>,+ #[max_length = 64]+ charge_id -> Nullable<Varchar>,+ #[max_length = 64]+ client_source -> Nullable<Varchar>,+ #[max_length = 64]+ client_version -> Nullable<Varchar>,+ customer_acceptance -> Nullable<Jsonb>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ payment_intent (payment_id, merchant_id) {+ #[max_length = 64]+ payment_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ status -> IntentStatus,+ amount -> Int8,+ currency -> Nullable<Currency>,+ amount_captured -> Nullable<Int8>,+ #[max_length = 64]+ customer_id -> Nullable<Varchar>,+ #[max_length = 255]+ description -> Nullable<Varchar>,+ #[max_length = 255]+ return_url -> Nullable<Varchar>,+ metadata -> Nullable<Jsonb>,+ #[max_length = 64]+ connector_id -> Nullable<Varchar>,+ #[max_length = 64]+ shipping_address_id -> Nullable<Varchar>,+ #[max_length = 64]+ billing_address_id -> Nullable<Varchar>,+ #[max_length = 255]+ statement_descriptor_name -> Nullable<Varchar>,+ #[max_length = 255]+ statement_descriptor_suffix -> Nullable<Varchar>,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ last_synced -> Nullable<Timestamp>,+ setup_future_usage -> Nullable<FutureUsage>,+ off_session -> Nullable<Bool>,+ #[max_length = 128]+ client_secret -> Nullable<Varchar>,+ #[max_length = 64]+ active_attempt_id -> Varchar,+ business_country -> Nullable<CountryAlpha2>,+ #[max_length = 64]+ business_label -> Nullable<Varchar>,+ order_details -> Nullable<Array<Nullable<Jsonb>>>,+ allowed_payment_method_types -> Nullable<Json>,+ connector_metadata -> Nullable<Json>,+ feature_metadata -> Nullable<Json>,+ attempt_count -> Int2,+ #[max_length = 64]+ profile_id -> Nullable<Varchar>,+ #[max_length = 64]+ merchant_decision -> Nullable<Varchar>,+ #[max_length = 255]+ payment_link_id -> Nullable<Varchar>,+ payment_confirm_source -> Nullable<PaymentSource>,+ #[max_length = 32]+ updated_by -> Varchar,+ surcharge_applicable -> Nullable<Bool>,+ request_incremental_authorization -> Nullable<RequestIncrementalAuthorization>,+ incremental_authorization_allowed -> Nullable<Bool>,+ authorization_count -> Nullable<Int4>,+ session_expiry -> Nullable<Timestamp>,+ #[max_length = 64]+ fingerprint_id -> Nullable<Varchar>,+ request_external_three_ds_authentication -> Nullable<Bool>,+ charges -> Nullable<Jsonb>,+ frm_metadata -> Nullable<Jsonb>,+ customer_details -> Nullable<Bytea>,+ billing_details -> Nullable<Bytea>,+ #[max_length = 255]+ merchant_order_reference_id -> Nullable<Varchar>,+ shipping_details -> Nullable<Bytea>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ payment_link (payment_link_id) {+ #[max_length = 255]+ payment_link_id -> Varchar,+ #[max_length = 64]+ payment_id -> Varchar,+ #[max_length = 255]+ link_to_pay -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ amount -> Int8,+ currency -> Nullable<Currency>,+ created_at -> Timestamp,+ last_modified_at -> Timestamp,+ fulfilment_time -> Nullable<Timestamp>,+ #[max_length = 64]+ custom_merchant_name -> Nullable<Varchar>,+ payment_link_config -> Nullable<Jsonb>,+ #[max_length = 255]+ description -> Nullable<Varchar>,+ #[max_length = 64]+ profile_id -> Nullable<Varchar>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ payment_methods (id) {+ id -> Int4,+ #[max_length = 64]+ customer_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ payment_method_id -> Varchar,+ accepted_currency -> Nullable<Array<Nullable<Currency>>>,+ #[max_length = 32]+ scheme -> Nullable<Varchar>,+ #[max_length = 128]+ token -> Nullable<Varchar>,+ #[max_length = 255]+ cardholder_name -> Nullable<Varchar>,+ #[max_length = 64]+ issuer_name -> Nullable<Varchar>,+ #[max_length = 64]+ issuer_country -> Nullable<Varchar>,+ payer_country -> Nullable<Array<Nullable<Text>>>,+ is_stored -> Nullable<Bool>,+ #[max_length = 32]+ swift_code -> Nullable<Varchar>,+ #[max_length = 128]+ direct_debit_token -> Nullable<Varchar>,+ created_at -> Timestamp,+ last_modified -> Timestamp,+ payment_method -> Nullable<Varchar>,+ #[max_length = 64]+ payment_method_type -> Nullable<Varchar>,+ #[max_length = 128]+ payment_method_issuer -> Nullable<Varchar>,+ payment_method_issuer_code -> Nullable<PaymentMethodIssuerCode>,+ metadata -> Nullable<Json>,+ payment_method_data -> Nullable<Bytea>,+ #[max_length = 64]+ locker_id -> Nullable<Varchar>,+ last_used_at -> Timestamp,+ connector_mandate_details -> Nullable<Jsonb>,+ customer_acceptance -> Nullable<Jsonb>,+ #[max_length = 64]+ status -> Varchar,+ #[max_length = 255]+ network_transaction_id -> Nullable<Varchar>,+ #[max_length = 128]+ client_secret -> Nullable<Varchar>,+ payment_method_billing_address -> Nullable<Bytea>,+ #[max_length = 64]+ updated_by -> Nullable<Varchar>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ payout_attempt (payout_attempt_id) {+ #[max_length = 64]+ payout_attempt_id -> Varchar,+ #[max_length = 64]+ payout_id -> Varchar,+ #[max_length = 64]+ customer_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ address_id -> Varchar,+ #[max_length = 64]+ connector -> Nullable<Varchar>,+ #[max_length = 128]+ connector_payout_id -> Nullable<Varchar>,+ #[max_length = 64]+ payout_token -> Nullable<Varchar>,+ status -> PayoutStatus,+ is_eligible -> Nullable<Bool>,+ error_message -> Nullable<Text>,+ #[max_length = 64]+ error_code -> Nullable<Varchar>,+ business_country -> Nullable<CountryAlpha2>,+ #[max_length = 64]+ business_label -> Nullable<Varchar>,+ created_at -> Timestamp,+ last_modified_at -> Timestamp,+ #[max_length = 64]+ profile_id -> Varchar,+ #[max_length = 32]+ merchant_connector_id -> Nullable<Varchar>,+ routing_info -> Nullable<Jsonb>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ payouts (payout_id) {+ #[max_length = 64]+ payout_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ customer_id -> Varchar,+ #[max_length = 64]+ address_id -> Varchar,+ payout_type -> Nullable<PayoutType>,+ #[max_length = 64]+ payout_method_id -> Nullable<Varchar>,+ amount -> Int8,+ destination_currency -> Currency,+ source_currency -> Currency,+ #[max_length = 255]+ description -> Nullable<Varchar>,+ recurring -> Bool,+ auto_fulfill -> Bool,+ #[max_length = 255]+ return_url -> Nullable<Varchar>,+ #[max_length = 64]+ entity_type -> Varchar,+ metadata -> Nullable<Jsonb>,+ created_at -> Timestamp,+ last_modified_at -> Timestamp,+ attempt_count -> Int2,+ #[max_length = 64]+ profile_id -> Varchar,+ status -> PayoutStatus,+ confirm -> Nullable<Bool>,+ #[max_length = 255]+ payout_link_id -> Nullable<Varchar>,+ #[max_length = 128]+ client_secret -> Nullable<Varchar>,+ #[max_length = 32]+ priority -> Nullable<Varchar>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ process_tracker (id) {+ #[max_length = 127]+ id -> Varchar,+ #[max_length = 64]+ name -> Nullable<Varchar>,+ tag -> Array<Nullable<Text>>,+ #[max_length = 64]+ runner -> Nullable<Varchar>,+ retry_count -> Int4,+ schedule_time -> Nullable<Timestamp>,+ #[max_length = 255]+ rule -> Varchar,+ tracking_data -> Json,+ #[max_length = 255]+ business_status -> Varchar,+ status -> ProcessTrackerStatus,+ event -> Array<Nullable<Text>>,+ created_at -> Timestamp,+ updated_at -> Timestamp,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ refund (id) {+ id -> Int4,+ #[max_length = 64]+ internal_reference_id -> Varchar,+ #[max_length = 64]+ refund_id -> Varchar,+ #[max_length = 64]+ payment_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 128]+ connector_transaction_id -> Varchar,+ #[max_length = 64]+ connector -> Varchar,+ #[max_length = 128]+ connector_refund_id -> Nullable<Varchar>,+ #[max_length = 64]+ external_reference_id -> Nullable<Varchar>,+ refund_type -> RefundType,+ total_amount -> Int8,+ currency -> Currency,+ refund_amount -> Int8,+ refund_status -> RefundStatus,+ sent_to_gateway -> Bool,+ refund_error_message -> Nullable<Text>,+ metadata -> Nullable<Json>,+ #[max_length = 128]+ refund_arn -> Nullable<Varchar>,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ #[max_length = 255]+ description -> Nullable<Varchar>,+ #[max_length = 64]+ attempt_id -> Varchar,+ #[max_length = 255]+ refund_reason -> Nullable<Varchar>,+ refund_error_code -> Nullable<Text>,+ #[max_length = 64]+ profile_id -> Nullable<Varchar>,+ #[max_length = 32]+ updated_by -> Varchar,+ #[max_length = 32]+ merchant_connector_id -> Nullable<Varchar>,+ charges -> Nullable<Jsonb>,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ reverse_lookup (lookup_id) {+ #[max_length = 128]+ lookup_id -> Varchar,+ #[max_length = 128]+ sk_id -> Varchar,+ #[max_length = 128]+ pk_id -> Varchar,+ #[max_length = 128]+ source -> Varchar,+ #[max_length = 32]+ updated_by -> Varchar,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ roles (id) {+ id -> Int4,+ #[max_length = 64]+ role_name -> Varchar,+ #[max_length = 64]+ role_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ org_id -> Varchar,+ groups -> Array<Nullable<Text>>,+ scope -> RoleScope,+ created_at -> Timestamp,+ #[max_length = 64]+ created_by -> Varchar,+ last_modified_at -> Timestamp,+ #[max_length = 64]+ last_modified_by -> Varchar,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ routing_algorithm (algorithm_id) {+ #[max_length = 64]+ algorithm_id -> Varchar,+ #[max_length = 64]+ profile_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ name -> Varchar,+ #[max_length = 256]+ description -> Nullable<Varchar>,+ kind -> RoutingAlgorithmKind,+ algorithm_data -> Jsonb,+ created_at -> Timestamp,+ modified_at -> Timestamp,+ algorithm_for -> TransactionType,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ user_authentication_methods (id) {+ #[max_length = 64]+ id -> Varchar,+ #[max_length = 64]+ auth_id -> Varchar,+ #[max_length = 64]+ owner_id -> Varchar,+ #[max_length = 64]+ owner_type -> Varchar,+ #[max_length = 64]+ auth_type -> Varchar,+ private_config -> Nullable<Bytea>,+ public_config -> Nullable<Jsonb>,+ allow_signup -> Bool,+ created_at -> Timestamp,+ last_modified_at -> Timestamp,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ user_key_store (user_id) {+ #[max_length = 64]+ user_id -> Varchar,+ key -> Bytea,+ created_at -> Timestamp,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ user_roles (id) {+ id -> Int4,+ #[max_length = 64]+ user_id -> Varchar,+ #[max_length = 64]+ merchant_id -> Varchar,+ #[max_length = 64]+ role_id -> Varchar,+ #[max_length = 64]+ org_id -> Varchar,+ status -> UserStatus,+ #[max_length = 64]+ created_by -> Varchar,+ #[max_length = 64]+ last_modified_by -> Varchar,+ created_at -> Timestamp,+ last_modified -> Timestamp,+ }+}++diesel::table! {+ use diesel::sql_types::*;+ use crate::enums::diesel_exports::*;++ users (id) {+ id -> Int4,+ #[max_length = 64]+ user_id -> Varchar,+ #[max_length = 255]+ email -> Varchar,+ #[max_length = 255]+ name -> Varchar,+ #[max_length = 255]+ password -> Nullable<Varchar>,+ is_verified -> Bool,+ created_at -> Timestamp,+ last_modified_at -> Timestamp,+ #[max_length = 64]+ preferred_merchant_id -> Nullable<Varchar>,+ totp_status -> TotpStatus,+ totp_secret -> Nullable<Bytea>,+ totp_recovery_codes -> Nullable<Array<Nullable<Text>>>,+ last_password_modified_at -> Nullable<Timestamp>,+ }+}++diesel::allow_tables_to_appear_in_same_query!(+ address,+ api_keys,+ authentication,+ blocklist,+ blocklist_fingerprint,+ blocklist_lookup,+ business_profile,+ captures,+ cards_info,+ configs,+ customers,+ dashboard_metadata,+ dispute,+ events,+ file_metadata,+ fraud_check,+ gateway_status_map,+ generic_link,+ incremental_authorization,+ locker_mock_up,+ mandate,+ merchant_account,+ merchant_connector_account,+ merchant_key_store,+ organization,+ payment_attempt,+ payment_intent,+ payment_link,+ payment_methods,+ payout_attempt,+ payouts,+ process_tracker,+ refund,+ reverse_lookup,+ roles,+ routing_algorithm,+ user_authentication_methods,+ user_key_store,+ user_roles,+ users,+);diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rsindex fb8ce2d696..6ff74a95e4 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs@@ -490,6 +490,7 @@ impl behaviour::Conversion for PaymentIntent {async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {Ok(DieselPaymentIntent {+ id: None,payment_id: self.payment_id,merchant_id: self.merchant_id,status: self.status,diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rsindex a5b1e90259..1524f99477 100644--- a/crates/storage_impl/src/payments/payment_attempt.rs+++ b/crates/storage_impl/src/payments/payment_attempt.rs@@ -1140,6 +1140,7 @@ impl DataModelExt for PaymentAttempt {fn to_storage_model(self) -> Self::StorageModel {DieselPaymentAttempt {+ id: None,payment_id: self.payment_id,merchant_id: self.merchant_id,attempt_id: self.attempt_id,diff --git a/diesel_v2.toml b/diesel_v2.tomlnew file mode 100644index 0000000000..aaad1eeeb5--- /dev/null+++ b/diesel_v2.toml@@ -0,0 +1,8 @@+# For documentation on how to configure this file,+# see diesel.rs/guides/configuring-diesel-cli++# use a separate file for schema of api v2+[print_schema]+file = "crates/diesel_models/src/schema_v2.rs"+import_types = ["diesel::sql_types::*", "crate::enums::diesel_exports::*"]+generate_missing_sql_type_definitions = falsediff --git a/docker-compose-development.yml b/docker-compose-development.ymlindex 5086a365f7..ebccb11404 100644--- a/docker-compose-development.yml+++ b/docker-compose-development.yml@@ -47,7 +47,7 @@ services:migration_runner:image: rust:latest- command: "bash -c 'cargo install diesel_cli --no-default-features --features postgres && make migrate'"+ command: "bash -c 'cargo install diesel_cli --no-default-features --features postgres && cargo install just && just migrate'"working_dir: /appnetworks:- router_netdiff --git a/docker-compose.yml b/docker-compose.ymlindex 9c8aa61dc9..ef6ff17b5e 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -42,7 +42,7 @@ services:migration_runner:image: rust:latest- command: "bash -c 'cargo install diesel_cli --no-default-features --features postgres && make migrate'"+ command: "bash -c 'cargo install diesel_cli --no-default-features --features postgres && cargo install just && just migrate'"working_dir: /appnetworks:- router_net@@ -139,7 +139,7 @@ services:labels:logs: "promtail"-### Web Client+ ### Web Clienthyperswitch-web:ports:- "9050:9050"@@ -180,8 +180,8 @@ services:condition: service_healthyhyperswitch-web:condition: service_started- labels:- logs: "promtail"+ labels:+ logs: "promtail"### Clustered Redis setupredis-cluster:@@ -324,19 +324,19 @@ services:KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1- KAFKA_PROCESS_ROLES: 'broker,controller'+ KAFKA_PROCESS_ROLES: "broker,controller"KAFKA_NODE_ID: 1- KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka0:29093'- KAFKA_LISTENERS: 'PLAINTEXT://kafka0:29092,CONTROLLER://kafka0:29093,PLAINTEXT_HOST://0.0.0.0:9092'- KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'- KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs'+ KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka0:29093"+ KAFKA_LISTENERS: "PLAINTEXT://kafka0:29092,CONTROLLER://kafka0:29093,PLAINTEXT_HOST://0.0.0.0:9092"+ KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER"+ KAFKA_LOG_DIRS: "/tmp/kraft-combined-logs"JMX_PORT: 9997KAFKA_JMX_OPTS: -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=kafka0 -Dcom.sun.management.jmxremote.rmi.port=9997profiles:- olapvolumes:- ./monitoring/kafka-script.sh:/tmp/update_run.sh- command: "bash -c 'if [ ! -f /tmp/update_run.sh ]; then echo \"ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?\" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi'"+ command: 'bash -c ''if [ ! -f /tmp/update_run.sh ]; then echo "ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi'''# Kafka UI for debugging kafka queueskafka-ui:@@ -407,9 +407,9 @@ services:profiles:- olapenvironment:- KAFKA_HOST: 'kafka0:29092'+ KAFKA_HOST: "kafka0:29092"networks:- router_netvolumes:- ./config/vector.yaml:/etc/vector/vector.yaml- - /var/run/docker.sock:/var/run/docker.sock\ No newline at end of file+ - /var/run/docker.sock:/var/run/docker.sockdiff --git a/docs/try_local_system.md b/docs/try_local_system.mdindex 12aaad8a58..e977a443c3 100644--- a/docs/try_local_system.md+++ b/docs/try_local_system.md@@ -228,10 +228,10 @@ for your distribution and follow along.cargo install diesel_cli --no-default-features --features postgres```-5. Make sure your system has the `pkg-config` package, OpenSSL and make installed:+5. Make sure your system has the `pkg-config` package and OpenSSL installed```shell- sudo apt install pkg-config libssl-dev make+ sudo apt install pkg-config libssl-dev```Once you're done with setting up the dependencies, proceed with@@ -437,6 +437,14 @@ You can opt to use your favorite package manager instead.echo 'PQ_LIB_DIR="$(brew --prefix libpq)/lib"' >> ~/.zshrc```+5. Install a command runner called `just`:++ In order to make running migrations easier, you can use a command runner called just++ ```shell+ cargo install just+ ```+Once you're done with setting up the dependencies, proceed with[setting up the database](#set-up-the-database).@@ -480,8 +488,24 @@ Once you're done with setting up the dependencies, proceed with3. Run database migrations:+ Export the `DATABASE_URL` env variable++ ```shell+ export DATABASE_URL=$DB_USER:$DB_PASS@localhost:5432/$DB_NAME+ ```++ Run the migrations++ - If you have just installed++ ```shell+ just migrate+ ```++ - Using the diesel-cli command+```shell- make migrate database-url=postgres://$DB_USER:$DB_PASS@localhost:5432/$DB_NAME+ diesel migration run```Once you're done with setting up the database, proceed withdiff --git a/justfile b/justfilenew file mode 100644index 0000000000..40d4820495--- /dev/null+++ b/justfile@@ -0,0 +1,126 @@+# List available recipes+list:+ @just --list --justfile {{ source_file() }}++fmt_flags := '--all'++# Run formatter+fmt *FLAGS:+ cargo +nightly fmt {{ fmt_flags }} {{ FLAGS }}++check_flags := '--all-features --all-targets'++# Check compilation of Rust code+check *FLAGS:+ cargo check {{ check_flags }} {{ FLAGS }}++alias c := check++# Check compilation of Rust code and catch common mistakes+clippy *FLAGS:+ cargo clippy {{ check_flags }} {{ FLAGS }}++alias cl := clippy++# Build binaries+build *FLAGS:+ cargo build {{ FLAGS }}++alias b := build++# Build release (optimized) binaries+build-release *FLAGS:+ cargo build --release --features release {{ FLAGS }}++alias br := build-release++# Run server+run *FLAGS:+ cargo run {{ FLAGS }}++alias r := run++doc_flags := '--all-features --all-targets'++# Generate documentation+doc *FLAGS:+ cargo doc {{ doc_flags }} {{ FLAGS }}++alias d := doc++# Build the `euclid_wasm` crate+euclid-wasm features='dummy_connector':+ wasm-pack build \+ --target web \+ --out-dir {{ source_directory() }}/wasm \+ --out-name euclid \+ {{ source_directory() }}/crates/euclid_wasm \+ --features '{{ features }}'++# Run pre-commit checks+precommit: fmt clippy++hack_flags := '--workspace --each-feature --all-targets'++# Check compilation of each cargo feature+hack:+ cargo hack check {{ hack_flags }}++# Use the env variables if present, or fallback to default values++db_user := env_var_or_default('DB_USER', 'db_user')+db_password := env_var_or_default('DB_PASSWORD', 'db_pass')+db_host := env_var_or_default('DB_HOST', 'localhost')+db_port := env_var_or_default('DB_PORT', '5432')+db_name := env_var_or_default('DB_NAME', 'hyperswitch_db')+default_db_url := 'postgresql://' + db_user + ':' + db_password + '@' + db_host + ':' + db_port / db_name+database_url := env_var_or_default('DATABASE_URL', default_db_url)+default_migration_params := ''+v2_migration_dir := source_directory() / 'v2_migrations'+v1_migration_dir := source_directory() / 'migrations'+resultant_dir := source_directory() / 'final-migrations'++# Copy v1 and v2 migrations to a single directory+[private]+copy_migrations:+ @mkdir -p {{ resultant_dir }}+ @cp -r {{ v1_migration_dir }}/. {{ v2_migration_dir }}/. {{ resultant_dir }}/+ echo "Created {{ resultant_dir }}"++# Delete the newly created directory+[private]+delete_dir_if_exists dir=resultant_dir:+ @rm -rf {{ dir }}++v1_config_file_dir := source_directory() / 'diesel.toml'+default_operation := 'run'++[private]+run_migration operation=default_operation migration_dir=v1_migration_dir config_file_dir=v1_config_file_dir url=database_url *other_params=default_migration_params:+ diesel migration \+ --database-url '{{ url }}' \+ {{ operation }} \+ --migration-dir '{{ migration_dir }}' \+ --config-file '{{ config_file_dir }}' \+ {{ other_params }}++# Run database migrations for v1+migrate operation=default_operation *args='': (run_migration operation v1_migration_dir v1_config_file_dir database_url args)++v2_config_file_dir := source_directory() / 'diesel_v2.toml'++# Run database migrations for v2+migrate_v2 operation=default_operation *args='':+ #! /usr/bin/env bash+ set -euo pipefail++ EXIT_CODE=0+ just copy_migrations+ just run_migration {{ operation }} {{ resultant_dir }} {{ v2_config_file_dir }} {{ database_url }} {{ args }} || EXIT_CODE=$?+ just delete_dir_if_exists+ exit $EXIT_CODE++# Drop database if exists and then create a new 'hyperswitch_db' Database+resurrect:+ psql -U postgres -c 'DROP DATABASE IF EXISTS hyperswitch_db';+ psql -U postgres -c 'CREATE DATABASE hyperswitch_db';