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: reorder v2 migrations folders (#8671)
Hrithikeshc573f611762c
diff --git a/crates/common_enums/src/enums.rs b/crates/common_enums/src/enums.rsindex 99b8c2e600..404804254e 100644--- a/crates/common_enums/src/enums.rs+++ b/crates/common_enums/src/enums.rs@@ -8073,6 +8073,7 @@ pub enum UIWidgetFormLayout {Clone,Copy,Debug,+ Default,Eq,PartialEq,serde::Deserialize,@@ -8085,6 +8086,7 @@ pub enum UIWidgetFormLayout {#[strum(serialize_all = "snake_case")]#[serde(rename_all = "snake_case")]pub enum DeleteStatus {+ #[default]Active,Redacted,}diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rsindex bbb76b53f4..e36eb305c4 100644--- a/crates/diesel_models/src/business_profile.rs+++ b/crates/diesel_models/src/business_profile.rs@@ -402,10 +402,10 @@ pub struct Profile {pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,pub should_collect_cvv_during_payment:Option<primitive_wrappers::ShouldCollectCvvDuringPayment>,- pub is_external_vault_enabled: Option<bool>,- pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,pub revenue_recovery_retry_algorithm_type: Option<common_enums::RevenueRecoveryAlgorithmType>,pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,+ pub is_external_vault_enabled: Option<bool>,+ pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,}impl Profile {diff --git a/crates/diesel_models/src/customers.rs b/crates/diesel_models/src/customers.rsindex ae6ff49d10..88fcd667f1 100644--- a/crates/diesel_models/src/customers.rs+++ b/crates/diesel_models/src/customers.rs@@ -6,7 +6,9 @@ use time::PrimitiveDateTime;#[cfg(feature = "v1")]use crate::schema::customers;#[cfg(feature = "v2")]-use crate::{enums::DeleteStatus, schema_v2::customers};+use crate::{+ diesel_impl::RequiredFromNullableWithDefault, enums::DeleteStatus, schema_v2::customers,+};#[cfg(feature = "v1")]#[derive(@@ -164,6 +166,7 @@ pub struct Customer {pub merchant_reference_id: Option<common_utils::id_type::CustomerId>,pub default_billing_address: Option<Encryption>,pub default_shipping_address: Option<Encryption>,+ #[diesel(deserialize_as = RequiredFromNullableWithDefault<DeleteStatus>)]pub status: DeleteStatus,pub id: common_utils::id_type::GlobalCustomerId,}diff --git a/crates/diesel_models/src/lib.rs b/crates/diesel_models/src/lib.rsindex e34e7e552d..246807a041 100644--- a/crates/diesel_models/src/lib.rs+++ b/crates/diesel_models/src/lib.rs@@ -61,6 +61,8 @@ pub mod user_key_store;pub mod user_role;use diesel_impl::{DieselArray, OptionalDieselArray};+#[cfg(feature = "v2")]+use diesel_impl::{RequiredFromNullable, RequiredFromNullableWithDefault};pub type StorageResult<T> = error_stack::Result<T, errors::DatabaseError>;pub type PgPooledConn = async_bb8_diesel::Connection<diesel::PgConnection>;@@ -71,7 +73,6 @@ pub use self::{payment_intent::*, payment_method::*, payout_attempt::*, payouts::*, process_tracker::*,refund::*, reverse_lookup::*, user_authentication_method::*,};-/// The types and implementations provided by this module are required for the schema generated by/// `diesel_cli` 2.0 to work with the types defined in Rust code. This is because/// [`diesel`][diesel] 2.0 [changed the nullability of array elements][diesel-2.0-array-nullability],@@ -83,6 +84,8 @@ pub use self::{/// [diesel-2.0-array-nullability]: https://diesel.rs/guides/migration_guide.html#2-0-0-nullability-of-array-elements#[doc(hidden)]pub(crate) mod diesel_impl {+ #[cfg(feature = "v2")]+ use common_utils::{id_type, types};use diesel::{deserialize::FromSql,pg::Pg,@@ -90,6 +93,9 @@ pub(crate) mod diesel_impl {Queryable,};+ #[cfg(feature = "v2")]+ use crate::enums;+pub struct DieselArray<T>(Vec<Option<T>>);impl<T> From<DieselArray<T>> for Vec<T> {@@ -130,6 +136,119 @@ pub(crate) mod diesel_impl {Ok(Self(row))}}+ #[cfg(feature = "v2")]+ /// If the DB value is null, this wrapper will return an error when deserializing.+ ///+ /// This is useful when you want to ensure that a field is always present, even if the database+ /// value is NULL. If the database column contains a NULL value, an error will be returned.+ pub struct RequiredFromNullable<T>(T);++ #[cfg(feature = "v2")]+ impl<T> RequiredFromNullable<T> {+ /// Extracts the inner value from the wrapper+ pub fn into_inner(self) -> T {+ self.0+ }+ }++ #[cfg(feature = "v2")]+ impl<T, ST, DB> Queryable<Nullable<ST>, DB> for RequiredFromNullable<T>+ where+ DB: diesel::backend::Backend,+ T: Queryable<ST, DB>,+ Option<T::Row>: FromSql<Nullable<ST>, DB>,+ ST: diesel::sql_types::SingleValue,+ {+ type Row = Option<T::Row>;++ fn build(row: Self::Row) -> diesel::deserialize::Result<Self> {+ match row {+ Some(inner_row) => {+ let value = T::build(inner_row)?;+ Ok(Self(value))+ }+ None => Err("Cannot deserialize NULL value for required field. Check if the database column that should not be NULL contains a NULL value.".into()),+ }+ }+ }++ #[cfg(feature = "v2")]+ /// If the DB value is null, this wrapper will provide a default value for the type `T`.+ ///+ /// This is useful when you want to ensure that a field is always present, even if the database+ /// value is NULL. The default value is provided by the `Default` trait implementation of `T`.+ pub struct RequiredFromNullableWithDefault<T>(T);+ #[cfg(feature = "v2")]+ impl<T> RequiredFromNullableWithDefault<T> {+ /// Extracts the inner value from the wrapper+ pub fn into_inner(self) -> T {+ self.0+ }+ }+ #[cfg(feature = "v2")]+ impl<T, ST, DB> Queryable<Nullable<ST>, DB> for RequiredFromNullableWithDefault<T>+ where+ DB: diesel::backend::Backend,+ T: Queryable<ST, DB>,+ T: Default,+ Option<T::Row>: FromSql<Nullable<ST>, DB>,+ ST: diesel::sql_types::SingleValue,+ {+ type Row = Option<T::Row>;++ fn build(row: Self::Row) -> diesel::deserialize::Result<Self> {+ match row {+ Some(inner_row) => {+ let value = T::build(inner_row)?;+ Ok(Self(value))+ }+ None => Ok(Self(T::default())),+ }+ }+ }++ #[cfg(feature = "v2")]+ /// Macro to implement From trait for types wrapped in RequiredFromNullable+ #[macro_export]+ macro_rules! impl_from_required_from_nullable {+ ($($type:ty),* $(,)?) => {+ $(+ impl From<$crate::RequiredFromNullable<$type>> for $type {+ fn from(wrapper: $crate::RequiredFromNullable<$type>) -> Self {+ wrapper.into_inner()+ }+ }+ )*+ };+ }++ #[cfg(feature = "v2")]+ /// Macro to implement From trait for types wrapped in RequiredFromNullableWithDefault+ #[macro_export]+ macro_rules! impl_from_required_from_nullable_with_default {+ ($($type:ty),* $(,)?) => {+ $(+ impl From<$crate::RequiredFromNullableWithDefault<$type>> for $type {+ fn from(wrapper: $crate::RequiredFromNullableWithDefault<$type>) -> Self {+ wrapper.into_inner()+ }+ }+ )*+ };+ }+ #[cfg(feature = "v2")]+ crate::impl_from_required_from_nullable_with_default!(enums::DeleteStatus);++ #[cfg(feature = "v2")]+ crate::impl_from_required_from_nullable!(+ enums::AuthenticationType,+ types::MinorUnit,+ enums::PaymentMethod,+ enums::Currency,+ id_type::ProfileId,+ time::PrimitiveDateTime,+ id_type::RefundReferenceId,+ );}pub(crate) mod metrics {diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rsindex be7f1b7ebe..958466acb1 100644--- a/crates/diesel_models/src/merchant_connector_account.rs+++ b/crates/diesel_models/src/merchant_connector_account.rs@@ -64,6 +64,9 @@ impl MerchantConnectorAccount {}}+#[cfg(feature = "v2")]+use crate::RequiredFromNullable;+#[cfg(feature = "v2")]#[derive(Clone,@@ -91,6 +94,7 @@ pub struct MerchantConnectorAccount {pub connector_webhook_details: Option<pii::SecretSerdeValue>,#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]pub frm_config: Option<Vec<pii::SecretSerdeValue>>,+ #[diesel(deserialize_as = RequiredFromNullable<id_type::ProfileId>)]pub profile_id: id_type::ProfileId,#[diesel(deserialize_as = super::OptionalDieselArray<String>)]pub applepay_verified_domains: Option<Vec<String>>,diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rsindex 361db5f135..41f4debb16 100644--- a/crates/diesel_models/src/payment_attempt.rs+++ b/crates/diesel_models/src/payment_attempt.rs@@ -15,7 +15,7 @@ use crate::enums as storage_enums;#[cfg(feature = "v1")]use crate::schema::payment_attempt;#[cfg(feature = "v2")]-use crate::schema_v2::payment_attempt;+use crate::{schema_v2::payment_attempt, RequiredFromNullable};common_utils::impl_to_sql_from_sql_json!(ConnectorMandateReferenceId);#[derive(@@ -48,6 +48,7 @@ pub struct PaymentAttempt {pub error_message: Option<String>,pub surcharge_amount: Option<MinorUnit>,pub payment_method_id: Option<id_type::GlobalPaymentMethodId>,+ #[diesel(deserialize_as = RequiredFromNullable<storage_enums::AuthenticationType>)]pub authentication_type: storage_enums::AuthenticationType,#[serde(with = "common_utils::custom_serde::iso8601")]pub created_at: PrimitiveDateTime,@@ -73,6 +74,7 @@ pub struct PaymentAttempt {pub encoded_data: Option<masking::Secret<String>>,pub unified_code: Option<String>,pub unified_message: Option<String>,+ #[diesel(deserialize_as = RequiredFromNullable<MinorUnit>)]pub net_amount: MinorUnit,pub external_three_ds_authentication_attempted: Option<bool>,pub authentication_connector: Option<String>,@@ -93,6 +95,8 @@ pub struct PaymentAttempt {pub charges: Option<common_types::payments::ConnectorChargeResponseData>,pub processor_merchant_id: Option<id_type::MerchantId>,pub created_by: Option<String>,+ pub connector_request_reference_id: Option<String>,+ #[diesel(deserialize_as = RequiredFromNullable<storage_enums::PaymentMethod>)]pub payment_method_type_v2: storage_enums::PaymentMethod,pub connector_payment_id: Option<ConnectorTransactionId>,pub payment_method_subtype: storage_enums::PaymentMethodType,@@ -114,7 +118,6 @@ pub struct PaymentAttempt {pub network_decline_code: Option<String>,/// A string indicating how to proceed with an network error if payment gateway provide one. This is used to understand the network error code better.pub network_error_message: Option<String>,- pub connector_request_reference_id: Option<String>,}#[cfg(feature = "v1")]diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rsindex bd18e43e31..4f78187771 100644--- a/crates/diesel_models/src/payment_intent.rs+++ b/crates/diesel_models/src/payment_intent.rs@@ -11,6 +11,8 @@ use crate::schema::payment_intent;use crate::schema_v2::payment_intent;#[cfg(feature = "v2")]use crate::types::{FeatureMetadata, OrderDetailsWithAmount};+#[cfg(feature = "v2")]+use crate::RequiredFromNullable;use crate::{business_profile::PaymentLinkBackgroundImageConfig, enums as storage_enums};#[cfg(feature = "v2")]@@ -20,6 +22,7 @@ pub struct PaymentIntent {pub merchant_id: common_utils::id_type::MerchantId,pub status: storage_enums::IntentStatus,pub amount: MinorUnit,+ #[diesel(deserialize_as = RequiredFromNullable<storage_enums::Currency>)]pub currency: storage_enums::Currency,pub amount_captured: Option<MinorUnit>,pub customer_id: Option<common_utils::id_type::GlobalCustomerId>,@@ -40,12 +43,14 @@ pub struct PaymentIntent {pub connector_metadata: Option<pii::SecretSerdeValue>,pub feature_metadata: Option<FeatureMetadata>,pub attempt_count: i16,+ #[diesel(deserialize_as = RequiredFromNullable<common_utils::id_type::ProfileId>)]pub profile_id: common_utils::id_type::ProfileId,pub payment_link_id: Option<String>,pub updated_by: String,pub surcharge_applicable: Option<bool>,pub request_incremental_authorization: Option<RequestIncrementalAuthorization>,pub authorization_count: Option<i32>,+ #[diesel(deserialize_as = RequiredFromNullable<PrimitiveDateTime>)]pub session_expiry: PrimitiveDateTime,pub request_external_three_ds_authentication: Option<bool>,pub frm_metadata: Option<pii::SecretSerdeValue>,diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rsindex f7cb1c595e..a3657e6a4d 100644--- a/crates/diesel_models/src/refund.rs+++ b/crates/diesel_models/src/refund.rs@@ -1,5 +1,5 @@use common_utils::{- pii,+ id_type, pii,types::{ChargeRefunds, ConnectorTransactionId, ConnectorTransactionIdTrait, MinorUnit},};use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};@@ -10,7 +10,8 @@ use crate::enums as storage_enums;#[cfg(feature = "v1")]use crate::schema::refund;#[cfg(feature = "v2")]-use crate::schema_v2::refund;+use crate::{schema_v2::refund, RequiredFromNullable};+#[cfg(feature = "v1")]#[derive(Clone,@@ -27,8 +28,8 @@ use crate::schema_v2::refund;pub struct Refund {pub internal_reference_id: String,pub refund_id: String, //merchant_reference id- pub payment_id: common_utils::id_type::PaymentId,- pub merchant_id: common_utils::id_type::MerchantId,+ pub payment_id: id_type::PaymentId,+ pub merchant_id: id_type::MerchantId,pub connector_transaction_id: ConnectorTransactionId,pub connector: String,pub connector_refund_id: Option<ConnectorTransactionId>,@@ -50,11 +51,11 @@ pub struct Refund {pub attempt_id: String,pub refund_reason: Option<String>,pub refund_error_code: Option<String>,- pub profile_id: Option<common_utils::id_type::ProfileId>,+ pub profile_id: Option<id_type::ProfileId>,pub updated_by: String,- pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,pub charges: Option<ChargeRefunds>,- pub organization_id: common_utils::id_type::OrganizationId,+ pub organization_id: id_type::OrganizationId,/// INFO: This field is deprecated and replaced by processor_refund_datapub connector_refund_data: Option<String>,/// INFO: This field is deprecated and replaced by processor_transaction_data@@ -82,8 +83,8 @@ pub struct Refund {)]#[diesel(table_name = refund, primary_key(id), check_for_backend(diesel::pg::Pg))]pub struct Refund {- pub payment_id: common_utils::id_type::GlobalPaymentId,- pub merchant_id: common_utils::id_type::MerchantId,+ pub payment_id: id_type::GlobalPaymentId,+ pub merchant_id: id_type::MerchantId,pub connector_transaction_id: ConnectorTransactionId,pub connector: String,pub connector_refund_id: Option<ConnectorTransactionId>,@@ -102,21 +103,22 @@ pub struct Refund {#[serde(with = "common_utils::custom_serde::iso8601")]pub modified_at: PrimitiveDateTime,pub description: Option<String>,- pub attempt_id: common_utils::id_type::GlobalAttemptId,+ pub attempt_id: id_type::GlobalAttemptId,pub refund_reason: Option<String>,pub refund_error_code: Option<String>,- pub profile_id: Option<common_utils::id_type::ProfileId>,+ pub profile_id: Option<id_type::ProfileId>,pub updated_by: String,pub charges: Option<ChargeRefunds>,- pub organization_id: common_utils::id_type::OrganizationId,+ pub organization_id: id_type::OrganizationId,pub split_refunds: Option<common_types::refunds::SplitRefund>,pub unified_code: Option<String>,pub unified_message: Option<String>,pub processor_refund_data: Option<String>,pub processor_transaction_data: Option<String>,- pub id: common_utils::id_type::GlobalRefundId,- pub merchant_reference_id: common_utils::id_type::RefundReferenceId,- pub connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,+ pub id: id_type::GlobalRefundId,+ #[diesel(deserialize_as = RequiredFromNullable<id_type::RefundReferenceId>)]+ pub merchant_reference_id: id_type::RefundReferenceId,+ pub connector_id: Option<id_type::MerchantConnectorAccountId>,}#[cfg(feature = "v1")]@@ -134,8 +136,8 @@ pub struct Refund {#[diesel(table_name = refund)]pub struct RefundNew {pub refund_id: String,- pub payment_id: common_utils::id_type::PaymentId,- pub merchant_id: common_utils::id_type::MerchantId,+ pub payment_id: id_type::PaymentId,+ pub merchant_id: id_type::MerchantId,pub internal_reference_id: String,pub external_reference_id: Option<String>,pub connector_transaction_id: ConnectorTransactionId,@@ -156,11 +158,11 @@ pub struct RefundNew {pub description: Option<String>,pub attempt_id: String,pub refund_reason: Option<String>,- pub profile_id: Option<common_utils::id_type::ProfileId>,+ pub profile_id: Option<id_type::ProfileId>,pub updated_by: String,- pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,pub charges: Option<ChargeRefunds>,- pub organization_id: common_utils::id_type::OrganizationId,+ pub organization_id: id_type::OrganizationId,pub split_refunds: Option<common_types::refunds::SplitRefund>,pub processor_refund_data: Option<String>,pub processor_transaction_data: Option<String>,@@ -180,10 +182,10 @@ pub struct RefundNew {)]#[diesel(table_name = refund)]pub struct RefundNew {- pub merchant_reference_id: common_utils::id_type::RefundReferenceId,- pub payment_id: common_utils::id_type::GlobalPaymentId,- pub merchant_id: common_utils::id_type::MerchantId,- pub id: common_utils::id_type::GlobalRefundId,+ pub merchant_reference_id: id_type::RefundReferenceId,+ pub payment_id: id_type::GlobalPaymentId,+ pub merchant_id: id_type::MerchantId,+ pub id: id_type::GlobalRefundId,pub external_reference_id: Option<String>,pub connector_transaction_id: ConnectorTransactionId,pub connector: String,@@ -201,13 +203,13 @@ pub struct RefundNew {#[serde(with = "common_utils::custom_serde::iso8601")]pub modified_at: PrimitiveDateTime,pub description: Option<String>,- pub attempt_id: common_utils::id_type::GlobalAttemptId,+ pub attempt_id: id_type::GlobalAttemptId,pub refund_reason: Option<String>,- pub profile_id: Option<common_utils::id_type::ProfileId>,+ pub profile_id: Option<id_type::ProfileId>,pub updated_by: String,- pub connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,+ pub connector_id: Option<id_type::MerchantConnectorAccountId>,pub charges: Option<ChargeRefunds>,- pub organization_id: common_utils::id_type::OrganizationId,+ pub organization_id: id_type::OrganizationId,pub split_refunds: Option<common_types::refunds::SplitRefund>,pub processor_refund_data: Option<String>,pub processor_transaction_data: Option<String>,@@ -781,18 +783,18 @@ impl RefundUpdate {pub struct RefundCoreWorkflow {pub refund_internal_reference_id: String,pub connector_transaction_id: ConnectorTransactionId,- pub merchant_id: common_utils::id_type::MerchantId,- pub payment_id: common_utils::id_type::PaymentId,+ pub merchant_id: id_type::MerchantId,+ pub payment_id: id_type::PaymentId,pub processor_transaction_data: Option<String>,}#[cfg(feature = "v2")]#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]pub struct RefundCoreWorkflow {- pub refund_id: common_utils::id_type::GlobalRefundId,+ pub refund_id: id_type::GlobalRefundId,pub connector_transaction_id: ConnectorTransactionId,- pub merchant_id: common_utils::id_type::MerchantId,- pub payment_id: common_utils::id_type::GlobalPaymentId,+ pub merchant_id: id_type::MerchantId,+ pub payment_id: id_type::GlobalPaymentId,pub processor_transaction_data: Option<String>,}diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rsindex 3f862a8205..95cbe20e19 100644--- a/crates/diesel_models/src/schema_v2.rs+++ b/crates/diesel_models/src/schema_v2.rs@@ -253,10 +253,10 @@ diesel::table! {default_fallback_routing -> Nullable<Jsonb>,three_ds_decision_manager_config -> Nullable<Jsonb>,should_collect_cvv_during_payment -> Nullable<Bool>,- is_external_vault_enabled -> Nullable<Bool>,- external_vault_connector_details -> Nullable<Jsonb>,revenue_recovery_retry_algorithm_type -> Nullable<RevenueRecoveryAlgorithmType>,revenue_recovery_retry_algorithm_data -> Nullable<Jsonb>,+ is_external_vault_enabled -> Nullable<Bool>,+ external_vault_connector_details -> Nullable<Jsonb>,}}@@ -375,7 +375,7 @@ diesel::table! {merchant_reference_id -> Nullable<Varchar>,default_billing_address -> Nullable<Bytea>,default_shipping_address -> Nullable<Bytea>,- status -> DeleteStatus,+ status -> Nullable<DeleteStatus>,#[max_length = 64]id -> Varchar,}@@ -792,7 +792,7 @@ diesel::table! {connector_webhook_details -> Nullable<Jsonb>,frm_config -> Nullable<Array<Nullable<Jsonb>>>,#[max_length = 64]- profile_id -> Varchar,+ profile_id -> Nullable<Varchar>,applepay_verified_domains -> Nullable<Array<Nullable<Text>>>,pm_auth_config -> Nullable<Jsonb>,status -> ConnectorStatus,@@ -853,7 +853,7 @@ diesel::table! {surcharge_amount -> Nullable<Int8>,#[max_length = 64]payment_method_id -> Nullable<Varchar>,- authentication_type -> AuthenticationType,+ authentication_type -> Nullable<AuthenticationType>,created_at -> Timestamp,modified_at -> Timestamp,last_synced -> Nullable<Timestamp>,@@ -884,7 +884,7 @@ diesel::table! {unified_code -> Nullable<Varchar>,#[max_length = 1024]unified_message -> Nullable<Varchar>,- net_amount -> Int8,+ net_amount -> Nullable<Int8>,external_three_ds_authentication_attempted -> Nullable<Bool>,#[max_length = 64]authentication_connector -> Nullable<Varchar>,@@ -914,7 +914,9 @@ diesel::table! {processor_merchant_id -> Nullable<Varchar>,#[max_length = 255]created_by -> Nullable<Varchar>,- payment_method_type_v2 -> Varchar,+ #[max_length = 255]+ connector_request_reference_id -> Nullable<Varchar>,+ payment_method_type_v2 -> Nullable<Varchar>,#[max_length = 128]connector_payment_id -> Nullable<Varchar>,#[max_length = 64]@@ -936,8 +938,6 @@ diesel::table! {#[max_length = 32]network_decline_code -> Nullable<Varchar>,network_error_message -> Nullable<Text>,- #[max_length = 255]- connector_request_reference_id -> Nullable<Varchar>,}}@@ -950,7 +950,7 @@ diesel::table! {merchant_id -> Varchar,status -> IntentStatus,amount -> Int8,- currency -> Currency,+ currency -> Nullable<Currency>,amount_captured -> Nullable<Int8>,#[max_length = 64]customer_id -> Nullable<Varchar>,@@ -971,7 +971,7 @@ diesel::table! {feature_metadata -> Nullable<Json>,attempt_count -> Int2,#[max_length = 64]- profile_id -> Varchar,+ profile_id -> Nullable<Varchar>,#[max_length = 255]payment_link_id -> Nullable<Varchar>,#[max_length = 32]@@ -979,7 +979,7 @@ diesel::table! {surcharge_applicable -> Nullable<Bool>,request_incremental_authorization -> Nullable<RequestIncrementalAuthorization>,authorization_count -> Nullable<Int4>,- session_expiry -> Timestamp,+ session_expiry -> Nullable<Timestamp>,request_external_three_ds_authentication -> Nullable<Bool>,frm_metadata -> Nullable<Jsonb>,customer_details -> Nullable<Bytea>,@@ -1272,7 +1272,7 @@ diesel::table! {#[max_length = 64]id -> Varchar,#[max_length = 64]- merchant_reference_id -> Varchar,+ merchant_reference_id -> Nullable<Varchar>,#[max_length = 64]connector_id -> Nullable<Varchar>,}diff --git a/v2_migrations/2025-01-17-042122_add_feature_metadata_in_payment_attempt/down.sql b/v2_compatible_migrations/2025-01-17-042122_add_feature_metadata_in_payment_attempt/down.sqlsimilarity index 100%rename from v2_migrations/2025-01-17-042122_add_feature_metadata_in_payment_attempt/down.sqlrename to v2_compatible_migrations/2025-01-17-042122_add_feature_metadata_in_payment_attempt/down.sqldiff --git a/v2_migrations/2025-01-17-042122_add_feature_metadata_in_payment_attempt/up.sql b/v2_compatible_migrations/2025-01-17-042122_add_feature_metadata_in_payment_attempt/up.sqlsimilarity index 100%rename from v2_migrations/2025-01-17-042122_add_feature_metadata_in_payment_attempt/up.sqlrename to v2_compatible_migrations/2025-01-17-042122_add_feature_metadata_in_payment_attempt/up.sqldiff --git a/v2_compatible_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/down.sql b/v2_compatible_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/down.sqlnew file mode 100644index 0000000000..6f51a37b42--- /dev/null+++ b/v2_compatible_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+DROP INDEX IF EXISTS payment_attempt_payment_id_index;\ No newline at end of filediff --git a/v2_compatible_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/up.sql b/v2_compatible_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/up.sqlnew file mode 100644index 0000000000..fec1764213--- /dev/null+++ b/v2_compatible_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/up.sql@@ -0,0 +1,2 @@+-- Your SQL goes here+CREATE INDEX IF NOT EXISTS payment_attempt_payment_id_index ON payment_attempt (payment_id);\ No newline at end of filediff --git a/v2_migrations/2025-02-24-053820_add_billing_processor_value_to_connector_type_enum/down.sql b/v2_compatible_migrations/2025-02-24-053820_add_billing_processor_value_to_connector_type_enum/down.sqlsimilarity index 100%rename from v2_migrations/2025-02-24-053820_add_billing_processor_value_to_connector_type_enum/down.sqlrename to v2_compatible_migrations/2025-02-24-053820_add_billing_processor_value_to_connector_type_enum/down.sqldiff --git a/v2_migrations/2025-02-24-053820_add_billing_processor_value_to_connector_type_enum/up.sql b/v2_compatible_migrations/2025-02-24-053820_add_billing_processor_value_to_connector_type_enum/up.sqlsimilarity index 100%rename from v2_migrations/2025-02-24-053820_add_billing_processor_value_to_connector_type_enum/up.sqlrename to v2_compatible_migrations/2025-02-24-053820_add_billing_processor_value_to_connector_type_enum/up.sqldiff --git a/v2_migrations/2025-03-19-080705_payment-method-subtype-optional/down.sql b/v2_compatible_migrations/2025-03-19-080705_payment-method-subtype-optional/down.sqlsimilarity index 100%rename from v2_migrations/2025-03-19-080705_payment-method-subtype-optional/down.sqlrename to v2_compatible_migrations/2025-03-19-080705_payment-method-subtype-optional/down.sqldiff --git a/v2_migrations/2025-03-19-080705_payment-method-subtype-optional/up.sql b/v2_compatible_migrations/2025-03-19-080705_payment-method-subtype-optional/up.sqlsimilarity index 100%rename from v2_migrations/2025-03-19-080705_payment-method-subtype-optional/up.sqlrename to v2_compatible_migrations/2025-03-19-080705_payment-method-subtype-optional/up.sqldiff --git a/v2_migrations/2025-03-25-074512_payment-method-subtype-mandatory/down.sql b/v2_compatible_migrations/2025-03-25-074512_payment-method-subtype-mandatory/down.sqlsimilarity index 100%rename from v2_migrations/2025-03-25-074512_payment-method-subtype-mandatory/down.sqlrename to v2_compatible_migrations/2025-03-25-074512_payment-method-subtype-mandatory/down.sqldiff --git a/v2_migrations/2025-03-25-074512_payment-method-subtype-mandatory/up.sql b/v2_compatible_migrations/2025-03-25-074512_payment-method-subtype-mandatory/up.sqlsimilarity index 100%rename from v2_migrations/2025-03-25-074512_payment-method-subtype-mandatory/up.sqlrename to v2_compatible_migrations/2025-03-25-074512_payment-method-subtype-mandatory/up.sqldiff --git a/v2_migrations/2025-04-02-051959_add_network_error_info_in_payment_attempt/down.sql b/v2_compatible_migrations/2025-04-02-051959_add_network_error_info_in_payment_attempt/down.sqlsimilarity index 100%rename from v2_migrations/2025-04-02-051959_add_network_error_info_in_payment_attempt/down.sqlrename to v2_compatible_migrations/2025-04-02-051959_add_network_error_info_in_payment_attempt/down.sqldiff --git a/v2_migrations/2025-04-02-051959_add_network_error_info_in_payment_attempt/up.sql b/v2_compatible_migrations/2025-04-02-051959_add_network_error_info_in_payment_attempt/up.sqlsimilarity index 100%rename from v2_migrations/2025-04-02-051959_add_network_error_info_in_payment_attempt/up.sqlrename to v2_compatible_migrations/2025-04-02-051959_add_network_error_info_in_payment_attempt/up.sqldiff --git a/v2_migrations/2025-04-08-101702_add_recovery_algorithm_column_in_business_profile/down.sql b/v2_compatible_migrations/2025-04-08-101702_add_recovery_algorithm_column_in_business_profile/down.sqlsimilarity index 100%rename from v2_migrations/2025-04-08-101702_add_recovery_algorithm_column_in_business_profile/down.sqlrename to v2_compatible_migrations/2025-04-08-101702_add_recovery_algorithm_column_in_business_profile/down.sqldiff --git a/v2_migrations/2025-04-08-101702_add_recovery_algorithm_column_in_business_profile/up.sql b/v2_compatible_migrations/2025-04-08-101702_add_recovery_algorithm_column_in_business_profile/up.sqlsimilarity index 100%rename from v2_migrations/2025-04-08-101702_add_recovery_algorithm_column_in_business_profile/up.sqlrename to v2_compatible_migrations/2025-04-08-101702_add_recovery_algorithm_column_in_business_profile/up.sqldiff --git a/v2_migrations/2025-04-25-105138_tokenization_service_creation/down.sql b/v2_compatible_migrations/2025-04-25-105138_tokenization_service_creation/down.sqlsimilarity index 100%rename from v2_migrations/2025-04-25-105138_tokenization_service_creation/down.sqlrename to v2_compatible_migrations/2025-04-25-105138_tokenization_service_creation/down.sqldiff --git a/v2_migrations/2025-04-25-105138_tokenization_service_creation/up.sql b/v2_compatible_migrations/2025-04-25-105138_tokenization_service_creation/up.sqlsimilarity index 100%rename from v2_migrations/2025-04-25-105138_tokenization_service_creation/up.sqlrename to v2_compatible_migrations/2025-04-25-105138_tokenization_service_creation/up.sqldiff --git a/v2_compatible_migrations/2025-07-16-035805_add_index_on_mca_for_profile_id/down.sql b/v2_compatible_migrations/2025-07-16-035805_add_index_on_mca_for_profile_id/down.sqlnew file mode 100644index 0000000000..a50f4cc4a5--- /dev/null+++ b/v2_compatible_migrations/2025-07-16-035805_add_index_on_mca_for_profile_id/down.sql@@ -0,0 +1 @@+DROP INDEX IF EXISTS merchant_connector_account_profile_id_index;\ No newline at end of filediff --git a/v2_compatible_migrations/2025-07-16-035805_add_index_on_mca_for_profile_id/up.sql b/v2_compatible_migrations/2025-07-16-035805_add_index_on_mca_for_profile_id/up.sqlnew file mode 100644index 0000000000..f5cd252fab--- /dev/null+++ b/v2_compatible_migrations/2025-07-16-035805_add_index_on_mca_for_profile_id/up.sql@@ -0,0 +1,3 @@+-- Create index on profile_id+CREATE INDEX IF NOT EXISTS merchant_connector_account_profile_id_index+ON merchant_connector_account (profile_id);diff --git a/v2_migrations/2024-08-28-081837_add_not_null_constraints_to_v2_columns/down.sql b/v2_migrations/2024-08-28-081837_add_not_null_constraints_to_v2_columns/down.sqldeleted file mode 100644index 6a10d16c5c..0000000000--- a/v2_migrations/2024-08-28-081837_add_not_null_constraints_to_v2_columns/down.sql+++ /dev/null@@ -1,26 +0,0 @@--- This file should undo anything in `up.sql`-ALTER TABLE customers- ALTER COLUMN status DROP NOT NULL,- ALTER COLUMN status DROP DEFAULT;--ALTER TABLE merchant_connector_account- ALTER COLUMN profile_id DROP NOT NULL;--ALTER TABLE payment_intent- ALTER COLUMN profile_id DROP NOT NULL,- ALTER COLUMN currency DROP NOT NULL,- ALTER COLUMN client_secret DROP NOT NULL,- ALTER COLUMN session_expiry DROP NOT NULL;--ALTER TABLE payment_attempt- ALTER COLUMN net_amount DROP NOT NULL;---- This migration is to make fields mandatory in payment_attempt table-ALTER TABLE payment_attempt- ALTER COLUMN net_amount DROP NOT NULL,- ALTER COLUMN authentication_type DROP NOT NULL,- ALTER COLUMN payment_method_type_v2 DROP NOT NULL,- ALTER COLUMN payment_method_subtype DROP NOT NULL;--ALTER TABLE refund- ALTER COLUMN merchant_reference_id DROP NOT NULL;\ No newline at end of filediff --git a/v2_migrations/2024-08-28-081837_add_not_null_constraints_to_v2_columns/up.sql b/v2_migrations/2024-08-28-081837_add_not_null_constraints_to_v2_columns/up.sqldeleted file mode 100644index 83b9b97cdc..0000000000--- a/v2_migrations/2024-08-28-081837_add_not_null_constraints_to_v2_columns/up.sql+++ /dev/null@@ -1,27 +0,0 @@--- Your SQL goes here--ALTER TABLE customers- ALTER COLUMN status SET NOT NULL,- ALTER COLUMN status SET DEFAULT 'active';---- This migration is to make profile_id mandatory in mca table-ALTER TABLE merchant_connector_account- ALTER COLUMN profile_id SET NOT NULL;---- This migration is to make fields mandatory in payment_intent table-ALTER TABLE payment_intent- ALTER COLUMN profile_id SET NOT NULL,- ALTER COLUMN currency SET NOT NULL,- ALTER COLUMN client_secret SET NOT NULL,- ALTER COLUMN session_expiry SET NOT NULL;---- This migration is to make fields mandatory in payment_attempt table-ALTER TABLE payment_attempt- ALTER COLUMN net_amount SET NOT NULL,- ALTER COLUMN authentication_type SET NOT NULL,- ALTER COLUMN payment_method_type_v2 SET NOT NULL,- ALTER COLUMN payment_method_subtype SET NOT NULL;---- This migration is to make fields mandatory in refund table-ALTER TABLE refund- ALTER COLUMN merchant_reference_id SET NOT NULL;\ No newline at end of filediff --git a/v2_migrations/2024-08-28-081838_update_v2_primary_key_constraints/down.sql b/v2_migrations/2024-08-28-081838_update_v2_primary_key_constraints/down.sqlindex a48c2b660f..268d286d90 100644--- a/v2_migrations/2024-08-28-081838_update_v2_primary_key_constraints/down.sql+++ b/v2_migrations/2024-08-28-081838_update_v2_primary_key_constraints/down.sql@@ -38,8 +38,6 @@ UPDATE merchant_connector_accountSET merchant_connector_id = idWHERE merchant_connector_id IS NULL;-DROP INDEX IF EXISTS merchant_connector_account_profile_id_index;------------------------- Customers ------------------------- Run this query only when V1 is deprecatedALTER TABLE customers DROP CONSTRAINT customers_pkey;diff --git a/v2_migrations/2024-08-28-081838_update_v2_primary_key_constraints/up.sql b/v2_migrations/2024-08-28-081838_update_v2_primary_key_constraints/up.sqlindex df0c434d68..6a7ed8ecdc 100644--- a/v2_migrations/2024-08-28-081838_update_v2_primary_key_constraints/up.sql+++ b/v2_migrations/2024-08-28-081838_update_v2_primary_key_constraints/up.sql@@ -48,10 +48,6 @@ WHERE id IS NULL;ALTER TABLE merchant_connector_accountADD PRIMARY KEY (id);--- Create index on profile_id-CREATE INDEX IF NOT EXISTS merchant_connector_account_profile_id_index-ON merchant_connector_account (profile_id);------------------------- Customers ------------------------- Backfill id column with customer_id valuesUPDATE customersdiff --git a/v2_migrations/2025-01-13-081847_drop_v1_columns/down.sql b/v2_migrations/2025-01-13-081847_drop_v1_columns/down.sqlindex f716de7bb0..f28582f186 100644--- a/v2_migrations/2025-01-13-081847_drop_v1_columns/down.sql+++ b/v2_migrations/2025-01-13-081847_drop_v1_columns/down.sql@@ -136,5 +136,3 @@ ALTER TABLE refundADD COLUMN IF NOT EXISTS internal_reference_id VARCHAR(64),ADD COLUMN IF NOT EXISTS refund_id VARCHAR(64),ADD COLUMN IF NOT EXISTS merchant_connector_id VARCHAR(64);--ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS connector_request_reference_id VARCHAR(255);\ No newline at end of filediff --git a/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql b/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sqlindex be5a7b845a..95348656f9 100644--- a/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql+++ b/v2_migrations/2025-01-13-081847_drop_v1_columns/up.sql@@ -130,8 +130,3 @@ ALTER TABLE refundDROP COLUMN IF EXISTS internal_reference_id,DROP COLUMN IF EXISTS refund_id,DROP COLUMN IF EXISTS merchant_connector_id;---- Run below queries only when V1 is deprecated-ALTER TABLE payment_attempt DROP COLUMN IF EXISTS connector_request_reference_id;--diff --git a/v2_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/down.sql b/v2_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/down.sqldeleted file mode 100644index 42c7d02ff2..0000000000--- a/v2_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/down.sql+++ /dev/null@@ -1,3 +0,0 @@--- This file should undo anything in `up.sql`-DROP INDEX IF EXISTS payment_attempt_payment_id_index;-CREATE INDEX IF NOT EXISTS payment_attempt_payment_id_merchant_id_index ON payment_attempt (payment_id, merchant_id);\ No newline at end of filediff --git a/v2_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/up.sql b/v2_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/up.sqldeleted file mode 100644index 9a9a9b077c..0000000000--- a/v2_migrations/2025-02-10-101458_create_index_payment_attempt_payment_id/up.sql+++ /dev/null@@ -1,3 +0,0 @@--- Your SQL goes here-DROP INDEX IF EXISTS payment_attempt_payment_id_merchant_id_index;-CREATE INDEX IF NOT EXISTS payment_attempt_payment_id_index ON payment_attempt (payment_id);\ No newline at end of filediff --git a/v2_migrations/2025-05-30-103514_add_connector_request_reference_id_in_payment_attempt/down.sql b/v2_migrations/2025-05-30-103514_add_connector_request_reference_id_in_payment_attempt/down.sqldeleted file mode 100644index da0137560b..0000000000--- a/v2_migrations/2025-05-30-103514_add_connector_request_reference_id_in_payment_attempt/down.sql+++ /dev/null@@ -1,2 +0,0 @@--- This file should undo anything in `up.sql`-ALTER TABLE payment_attempt DROP COLUMN IF EXISTS connector_request_reference_id;\ No newline at end of filediff --git a/v2_migrations/2025-05-30-103514_add_connector_request_reference_id_in_payment_attempt/up.sql b/v2_migrations/2025-05-30-103514_add_connector_request_reference_id_in_payment_attempt/up.sqldeleted file mode 100644index cda71f826f..0000000000--- a/v2_migrations/2025-05-30-103514_add_connector_request_reference_id_in_payment_attempt/up.sql+++ /dev/null@@ -1,2 +0,0 @@--- Your SQL goes here-ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS connector_request_reference_id VARCHAR(255);\ No newline at end of file