mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
chore: reorder v2 migrations folders (#8671)
This commit is contained in:
@ -8073,6 +8073,7 @@ pub enum UIWidgetFormLayout {
|
|||||||
Clone,
|
Clone,
|
||||||
Copy,
|
Copy,
|
||||||
Debug,
|
Debug,
|
||||||
|
Default,
|
||||||
Eq,
|
Eq,
|
||||||
PartialEq,
|
PartialEq,
|
||||||
serde::Deserialize,
|
serde::Deserialize,
|
||||||
@ -8085,6 +8086,7 @@ pub enum UIWidgetFormLayout {
|
|||||||
#[strum(serialize_all = "snake_case")]
|
#[strum(serialize_all = "snake_case")]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum DeleteStatus {
|
pub enum DeleteStatus {
|
||||||
|
#[default]
|
||||||
Active,
|
Active,
|
||||||
Redacted,
|
Redacted,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -402,10 +402,10 @@ pub struct Profile {
|
|||||||
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
|
pub three_ds_decision_manager_config: Option<common_types::payments::DecisionManagerRecord>,
|
||||||
pub should_collect_cvv_during_payment:
|
pub should_collect_cvv_during_payment:
|
||||||
Option<primitive_wrappers::ShouldCollectCvvDuringPayment>,
|
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_type: Option<common_enums::RevenueRecoveryAlgorithmType>,
|
||||||
pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,
|
pub revenue_recovery_retry_algorithm_data: Option<RevenueRecoveryAlgorithmData>,
|
||||||
|
pub is_external_vault_enabled: Option<bool>,
|
||||||
|
pub external_vault_connector_details: Option<ExternalVaultConnectorDetails>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Profile {
|
impl Profile {
|
||||||
|
|||||||
@ -6,7 +6,9 @@ use time::PrimitiveDateTime;
|
|||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
use crate::schema::customers;
|
use crate::schema::customers;
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
use crate::{enums::DeleteStatus, schema_v2::customers};
|
use crate::{
|
||||||
|
diesel_impl::RequiredFromNullableWithDefault, enums::DeleteStatus, schema_v2::customers,
|
||||||
|
};
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
#[derive(
|
#[derive(
|
||||||
@ -164,6 +166,7 @@ pub struct Customer {
|
|||||||
pub merchant_reference_id: Option<common_utils::id_type::CustomerId>,
|
pub merchant_reference_id: Option<common_utils::id_type::CustomerId>,
|
||||||
pub default_billing_address: Option<Encryption>,
|
pub default_billing_address: Option<Encryption>,
|
||||||
pub default_shipping_address: Option<Encryption>,
|
pub default_shipping_address: Option<Encryption>,
|
||||||
|
#[diesel(deserialize_as = RequiredFromNullableWithDefault<DeleteStatus>)]
|
||||||
pub status: DeleteStatus,
|
pub status: DeleteStatus,
|
||||||
pub id: common_utils::id_type::GlobalCustomerId,
|
pub id: common_utils::id_type::GlobalCustomerId,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,6 +61,8 @@ pub mod user_key_store;
|
|||||||
pub mod user_role;
|
pub mod user_role;
|
||||||
|
|
||||||
use diesel_impl::{DieselArray, OptionalDieselArray};
|
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 StorageResult<T> = error_stack::Result<T, errors::DatabaseError>;
|
||||||
pub type PgPooledConn = async_bb8_diesel::Connection<diesel::PgConnection>;
|
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::*,
|
payment_intent::*, payment_method::*, payout_attempt::*, payouts::*, process_tracker::*,
|
||||||
refund::*, reverse_lookup::*, user_authentication_method::*,
|
refund::*, reverse_lookup::*, user_authentication_method::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The types and implementations provided by this module are required for the schema generated by
|
/// 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_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],
|
/// [`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
|
/// [diesel-2.0-array-nullability]: https://diesel.rs/guides/migration_guide.html#2-0-0-nullability-of-array-elements
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub(crate) mod diesel_impl {
|
pub(crate) mod diesel_impl {
|
||||||
|
#[cfg(feature = "v2")]
|
||||||
|
use common_utils::{id_type, types};
|
||||||
use diesel::{
|
use diesel::{
|
||||||
deserialize::FromSql,
|
deserialize::FromSql,
|
||||||
pg::Pg,
|
pg::Pg,
|
||||||
@ -90,6 +93,9 @@ pub(crate) mod diesel_impl {
|
|||||||
Queryable,
|
Queryable,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "v2")]
|
||||||
|
use crate::enums;
|
||||||
|
|
||||||
pub struct DieselArray<T>(Vec<Option<T>>);
|
pub struct DieselArray<T>(Vec<Option<T>>);
|
||||||
|
|
||||||
impl<T> From<DieselArray<T>> for Vec<T> {
|
impl<T> From<DieselArray<T>> for Vec<T> {
|
||||||
@ -130,6 +136,119 @@ pub(crate) mod diesel_impl {
|
|||||||
Ok(Self(row))
|
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 {
|
pub(crate) mod metrics {
|
||||||
|
|||||||
@ -64,6 +64,9 @@ impl MerchantConnectorAccount {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "v2")]
|
||||||
|
use crate::RequiredFromNullable;
|
||||||
|
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone,
|
Clone,
|
||||||
@ -91,6 +94,7 @@ pub struct MerchantConnectorAccount {
|
|||||||
pub connector_webhook_details: Option<pii::SecretSerdeValue>,
|
pub connector_webhook_details: Option<pii::SecretSerdeValue>,
|
||||||
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
|
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
|
||||||
pub frm_config: Option<Vec<pii::SecretSerdeValue>>,
|
pub frm_config: Option<Vec<pii::SecretSerdeValue>>,
|
||||||
|
#[diesel(deserialize_as = RequiredFromNullable<id_type::ProfileId>)]
|
||||||
pub profile_id: id_type::ProfileId,
|
pub profile_id: id_type::ProfileId,
|
||||||
#[diesel(deserialize_as = super::OptionalDieselArray<String>)]
|
#[diesel(deserialize_as = super::OptionalDieselArray<String>)]
|
||||||
pub applepay_verified_domains: Option<Vec<String>>,
|
pub applepay_verified_domains: Option<Vec<String>>,
|
||||||
|
|||||||
@ -15,7 +15,7 @@ use crate::enums as storage_enums;
|
|||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
use crate::schema::payment_attempt;
|
use crate::schema::payment_attempt;
|
||||||
#[cfg(feature = "v2")]
|
#[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);
|
common_utils::impl_to_sql_from_sql_json!(ConnectorMandateReferenceId);
|
||||||
#[derive(
|
#[derive(
|
||||||
@ -48,6 +48,7 @@ pub struct PaymentAttempt {
|
|||||||
pub error_message: Option<String>,
|
pub error_message: Option<String>,
|
||||||
pub surcharge_amount: Option<MinorUnit>,
|
pub surcharge_amount: Option<MinorUnit>,
|
||||||
pub payment_method_id: Option<id_type::GlobalPaymentMethodId>,
|
pub payment_method_id: Option<id_type::GlobalPaymentMethodId>,
|
||||||
|
#[diesel(deserialize_as = RequiredFromNullable<storage_enums::AuthenticationType>)]
|
||||||
pub authentication_type: storage_enums::AuthenticationType,
|
pub authentication_type: storage_enums::AuthenticationType,
|
||||||
#[serde(with = "common_utils::custom_serde::iso8601")]
|
#[serde(with = "common_utils::custom_serde::iso8601")]
|
||||||
pub created_at: PrimitiveDateTime,
|
pub created_at: PrimitiveDateTime,
|
||||||
@ -73,6 +74,7 @@ pub struct PaymentAttempt {
|
|||||||
pub encoded_data: Option<masking::Secret<String>>,
|
pub encoded_data: Option<masking::Secret<String>>,
|
||||||
pub unified_code: Option<String>,
|
pub unified_code: Option<String>,
|
||||||
pub unified_message: Option<String>,
|
pub unified_message: Option<String>,
|
||||||
|
#[diesel(deserialize_as = RequiredFromNullable<MinorUnit>)]
|
||||||
pub net_amount: MinorUnit,
|
pub net_amount: MinorUnit,
|
||||||
pub external_three_ds_authentication_attempted: Option<bool>,
|
pub external_three_ds_authentication_attempted: Option<bool>,
|
||||||
pub authentication_connector: Option<String>,
|
pub authentication_connector: Option<String>,
|
||||||
@ -93,6 +95,8 @@ pub struct PaymentAttempt {
|
|||||||
pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
|
pub charges: Option<common_types::payments::ConnectorChargeResponseData>,
|
||||||
pub processor_merchant_id: Option<id_type::MerchantId>,
|
pub processor_merchant_id: Option<id_type::MerchantId>,
|
||||||
pub created_by: Option<String>,
|
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 payment_method_type_v2: storage_enums::PaymentMethod,
|
||||||
pub connector_payment_id: Option<ConnectorTransactionId>,
|
pub connector_payment_id: Option<ConnectorTransactionId>,
|
||||||
pub payment_method_subtype: storage_enums::PaymentMethodType,
|
pub payment_method_subtype: storage_enums::PaymentMethodType,
|
||||||
@ -114,7 +118,6 @@ pub struct PaymentAttempt {
|
|||||||
pub network_decline_code: Option<String>,
|
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.
|
/// 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 network_error_message: Option<String>,
|
||||||
pub connector_request_reference_id: Option<String>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
|
|||||||
@ -11,6 +11,8 @@ use crate::schema::payment_intent;
|
|||||||
use crate::schema_v2::payment_intent;
|
use crate::schema_v2::payment_intent;
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
use crate::types::{FeatureMetadata, OrderDetailsWithAmount};
|
use crate::types::{FeatureMetadata, OrderDetailsWithAmount};
|
||||||
|
#[cfg(feature = "v2")]
|
||||||
|
use crate::RequiredFromNullable;
|
||||||
use crate::{business_profile::PaymentLinkBackgroundImageConfig, enums as storage_enums};
|
use crate::{business_profile::PaymentLinkBackgroundImageConfig, enums as storage_enums};
|
||||||
|
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
@ -20,6 +22,7 @@ pub struct PaymentIntent {
|
|||||||
pub merchant_id: common_utils::id_type::MerchantId,
|
pub merchant_id: common_utils::id_type::MerchantId,
|
||||||
pub status: storage_enums::IntentStatus,
|
pub status: storage_enums::IntentStatus,
|
||||||
pub amount: MinorUnit,
|
pub amount: MinorUnit,
|
||||||
|
#[diesel(deserialize_as = RequiredFromNullable<storage_enums::Currency>)]
|
||||||
pub currency: storage_enums::Currency,
|
pub currency: storage_enums::Currency,
|
||||||
pub amount_captured: Option<MinorUnit>,
|
pub amount_captured: Option<MinorUnit>,
|
||||||
pub customer_id: Option<common_utils::id_type::GlobalCustomerId>,
|
pub customer_id: Option<common_utils::id_type::GlobalCustomerId>,
|
||||||
@ -40,12 +43,14 @@ pub struct PaymentIntent {
|
|||||||
pub connector_metadata: Option<pii::SecretSerdeValue>,
|
pub connector_metadata: Option<pii::SecretSerdeValue>,
|
||||||
pub feature_metadata: Option<FeatureMetadata>,
|
pub feature_metadata: Option<FeatureMetadata>,
|
||||||
pub attempt_count: i16,
|
pub attempt_count: i16,
|
||||||
|
#[diesel(deserialize_as = RequiredFromNullable<common_utils::id_type::ProfileId>)]
|
||||||
pub profile_id: common_utils::id_type::ProfileId,
|
pub profile_id: common_utils::id_type::ProfileId,
|
||||||
pub payment_link_id: Option<String>,
|
pub payment_link_id: Option<String>,
|
||||||
pub updated_by: String,
|
pub updated_by: String,
|
||||||
pub surcharge_applicable: Option<bool>,
|
pub surcharge_applicable: Option<bool>,
|
||||||
pub request_incremental_authorization: Option<RequestIncrementalAuthorization>,
|
pub request_incremental_authorization: Option<RequestIncrementalAuthorization>,
|
||||||
pub authorization_count: Option<i32>,
|
pub authorization_count: Option<i32>,
|
||||||
|
#[diesel(deserialize_as = RequiredFromNullable<PrimitiveDateTime>)]
|
||||||
pub session_expiry: PrimitiveDateTime,
|
pub session_expiry: PrimitiveDateTime,
|
||||||
pub request_external_three_ds_authentication: Option<bool>,
|
pub request_external_three_ds_authentication: Option<bool>,
|
||||||
pub frm_metadata: Option<pii::SecretSerdeValue>,
|
pub frm_metadata: Option<pii::SecretSerdeValue>,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
use common_utils::{
|
use common_utils::{
|
||||||
pii,
|
id_type, pii,
|
||||||
types::{ChargeRefunds, ConnectorTransactionId, ConnectorTransactionIdTrait, MinorUnit},
|
types::{ChargeRefunds, ConnectorTransactionId, ConnectorTransactionIdTrait, MinorUnit},
|
||||||
};
|
};
|
||||||
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
|
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
|
||||||
@ -10,7 +10,8 @@ use crate::enums as storage_enums;
|
|||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
use crate::schema::refund;
|
use crate::schema::refund;
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
use crate::schema_v2::refund;
|
use crate::{schema_v2::refund, RequiredFromNullable};
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
#[derive(
|
#[derive(
|
||||||
Clone,
|
Clone,
|
||||||
@ -27,8 +28,8 @@ use crate::schema_v2::refund;
|
|||||||
pub struct Refund {
|
pub struct Refund {
|
||||||
pub internal_reference_id: String,
|
pub internal_reference_id: String,
|
||||||
pub refund_id: String, //merchant_reference id
|
pub refund_id: String, //merchant_reference id
|
||||||
pub payment_id: common_utils::id_type::PaymentId,
|
pub payment_id: id_type::PaymentId,
|
||||||
pub merchant_id: common_utils::id_type::MerchantId,
|
pub merchant_id: id_type::MerchantId,
|
||||||
pub connector_transaction_id: ConnectorTransactionId,
|
pub connector_transaction_id: ConnectorTransactionId,
|
||||||
pub connector: String,
|
pub connector: String,
|
||||||
pub connector_refund_id: Option<ConnectorTransactionId>,
|
pub connector_refund_id: Option<ConnectorTransactionId>,
|
||||||
@ -50,11 +51,11 @@ pub struct Refund {
|
|||||||
pub attempt_id: String,
|
pub attempt_id: String,
|
||||||
pub refund_reason: Option<String>,
|
pub refund_reason: Option<String>,
|
||||||
pub refund_error_code: 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 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 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_data
|
/// INFO: This field is deprecated and replaced by processor_refund_data
|
||||||
pub connector_refund_data: Option<String>,
|
pub connector_refund_data: Option<String>,
|
||||||
/// INFO: This field is deprecated and replaced by processor_transaction_data
|
/// 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))]
|
#[diesel(table_name = refund, primary_key(id), check_for_backend(diesel::pg::Pg))]
|
||||||
pub struct Refund {
|
pub struct Refund {
|
||||||
pub payment_id: common_utils::id_type::GlobalPaymentId,
|
pub payment_id: id_type::GlobalPaymentId,
|
||||||
pub merchant_id: common_utils::id_type::MerchantId,
|
pub merchant_id: id_type::MerchantId,
|
||||||
pub connector_transaction_id: ConnectorTransactionId,
|
pub connector_transaction_id: ConnectorTransactionId,
|
||||||
pub connector: String,
|
pub connector: String,
|
||||||
pub connector_refund_id: Option<ConnectorTransactionId>,
|
pub connector_refund_id: Option<ConnectorTransactionId>,
|
||||||
@ -102,21 +103,22 @@ pub struct Refund {
|
|||||||
#[serde(with = "common_utils::custom_serde::iso8601")]
|
#[serde(with = "common_utils::custom_serde::iso8601")]
|
||||||
pub modified_at: PrimitiveDateTime,
|
pub modified_at: PrimitiveDateTime,
|
||||||
pub description: Option<String>,
|
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_reason: Option<String>,
|
||||||
pub refund_error_code: 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 updated_by: String,
|
||||||
pub charges: Option<ChargeRefunds>,
|
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 split_refunds: Option<common_types::refunds::SplitRefund>,
|
||||||
pub unified_code: Option<String>,
|
pub unified_code: Option<String>,
|
||||||
pub unified_message: Option<String>,
|
pub unified_message: Option<String>,
|
||||||
pub processor_refund_data: Option<String>,
|
pub processor_refund_data: Option<String>,
|
||||||
pub processor_transaction_data: Option<String>,
|
pub processor_transaction_data: Option<String>,
|
||||||
pub id: common_utils::id_type::GlobalRefundId,
|
pub id: id_type::GlobalRefundId,
|
||||||
pub merchant_reference_id: common_utils::id_type::RefundReferenceId,
|
#[diesel(deserialize_as = RequiredFromNullable<id_type::RefundReferenceId>)]
|
||||||
pub connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
|
pub merchant_reference_id: id_type::RefundReferenceId,
|
||||||
|
pub connector_id: Option<id_type::MerchantConnectorAccountId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v1")]
|
#[cfg(feature = "v1")]
|
||||||
@ -134,8 +136,8 @@ pub struct Refund {
|
|||||||
#[diesel(table_name = refund)]
|
#[diesel(table_name = refund)]
|
||||||
pub struct RefundNew {
|
pub struct RefundNew {
|
||||||
pub refund_id: String,
|
pub refund_id: String,
|
||||||
pub payment_id: common_utils::id_type::PaymentId,
|
pub payment_id: id_type::PaymentId,
|
||||||
pub merchant_id: common_utils::id_type::MerchantId,
|
pub merchant_id: id_type::MerchantId,
|
||||||
pub internal_reference_id: String,
|
pub internal_reference_id: String,
|
||||||
pub external_reference_id: Option<String>,
|
pub external_reference_id: Option<String>,
|
||||||
pub connector_transaction_id: ConnectorTransactionId,
|
pub connector_transaction_id: ConnectorTransactionId,
|
||||||
@ -156,11 +158,11 @@ pub struct RefundNew {
|
|||||||
pub description: Option<String>,
|
pub description: Option<String>,
|
||||||
pub attempt_id: String,
|
pub attempt_id: String,
|
||||||
pub refund_reason: Option<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 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 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 split_refunds: Option<common_types::refunds::SplitRefund>,
|
||||||
pub processor_refund_data: Option<String>,
|
pub processor_refund_data: Option<String>,
|
||||||
pub processor_transaction_data: Option<String>,
|
pub processor_transaction_data: Option<String>,
|
||||||
@ -180,10 +182,10 @@ pub struct RefundNew {
|
|||||||
)]
|
)]
|
||||||
#[diesel(table_name = refund)]
|
#[diesel(table_name = refund)]
|
||||||
pub struct RefundNew {
|
pub struct RefundNew {
|
||||||
pub merchant_reference_id: common_utils::id_type::RefundReferenceId,
|
pub merchant_reference_id: id_type::RefundReferenceId,
|
||||||
pub payment_id: common_utils::id_type::GlobalPaymentId,
|
pub payment_id: id_type::GlobalPaymentId,
|
||||||
pub merchant_id: common_utils::id_type::MerchantId,
|
pub merchant_id: id_type::MerchantId,
|
||||||
pub id: common_utils::id_type::GlobalRefundId,
|
pub id: id_type::GlobalRefundId,
|
||||||
pub external_reference_id: Option<String>,
|
pub external_reference_id: Option<String>,
|
||||||
pub connector_transaction_id: ConnectorTransactionId,
|
pub connector_transaction_id: ConnectorTransactionId,
|
||||||
pub connector: String,
|
pub connector: String,
|
||||||
@ -201,13 +203,13 @@ pub struct RefundNew {
|
|||||||
#[serde(with = "common_utils::custom_serde::iso8601")]
|
#[serde(with = "common_utils::custom_serde::iso8601")]
|
||||||
pub modified_at: PrimitiveDateTime,
|
pub modified_at: PrimitiveDateTime,
|
||||||
pub description: Option<String>,
|
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_reason: Option<String>,
|
||||||
pub profile_id: Option<common_utils::id_type::ProfileId>,
|
pub profile_id: Option<id_type::ProfileId>,
|
||||||
pub updated_by: String,
|
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 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 split_refunds: Option<common_types::refunds::SplitRefund>,
|
||||||
pub processor_refund_data: Option<String>,
|
pub processor_refund_data: Option<String>,
|
||||||
pub processor_transaction_data: Option<String>,
|
pub processor_transaction_data: Option<String>,
|
||||||
@ -781,18 +783,18 @@ impl RefundUpdate {
|
|||||||
pub struct RefundCoreWorkflow {
|
pub struct RefundCoreWorkflow {
|
||||||
pub refund_internal_reference_id: String,
|
pub refund_internal_reference_id: String,
|
||||||
pub connector_transaction_id: ConnectorTransactionId,
|
pub connector_transaction_id: ConnectorTransactionId,
|
||||||
pub merchant_id: common_utils::id_type::MerchantId,
|
pub merchant_id: id_type::MerchantId,
|
||||||
pub payment_id: common_utils::id_type::PaymentId,
|
pub payment_id: id_type::PaymentId,
|
||||||
pub processor_transaction_data: Option<String>,
|
pub processor_transaction_data: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "v2")]
|
#[cfg(feature = "v2")]
|
||||||
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]
|
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]
|
||||||
pub struct RefundCoreWorkflow {
|
pub struct RefundCoreWorkflow {
|
||||||
pub refund_id: common_utils::id_type::GlobalRefundId,
|
pub refund_id: id_type::GlobalRefundId,
|
||||||
pub connector_transaction_id: ConnectorTransactionId,
|
pub connector_transaction_id: ConnectorTransactionId,
|
||||||
pub merchant_id: common_utils::id_type::MerchantId,
|
pub merchant_id: id_type::MerchantId,
|
||||||
pub payment_id: common_utils::id_type::GlobalPaymentId,
|
pub payment_id: id_type::GlobalPaymentId,
|
||||||
pub processor_transaction_data: Option<String>,
|
pub processor_transaction_data: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -253,10 +253,10 @@ diesel::table! {
|
|||||||
default_fallback_routing -> Nullable<Jsonb>,
|
default_fallback_routing -> Nullable<Jsonb>,
|
||||||
three_ds_decision_manager_config -> Nullable<Jsonb>,
|
three_ds_decision_manager_config -> Nullable<Jsonb>,
|
||||||
should_collect_cvv_during_payment -> Nullable<Bool>,
|
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_type -> Nullable<RevenueRecoveryAlgorithmType>,
|
||||||
revenue_recovery_retry_algorithm_data -> Nullable<Jsonb>,
|
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>,
|
merchant_reference_id -> Nullable<Varchar>,
|
||||||
default_billing_address -> Nullable<Bytea>,
|
default_billing_address -> Nullable<Bytea>,
|
||||||
default_shipping_address -> Nullable<Bytea>,
|
default_shipping_address -> Nullable<Bytea>,
|
||||||
status -> DeleteStatus,
|
status -> Nullable<DeleteStatus>,
|
||||||
#[max_length = 64]
|
#[max_length = 64]
|
||||||
id -> Varchar,
|
id -> Varchar,
|
||||||
}
|
}
|
||||||
@ -792,7 +792,7 @@ diesel::table! {
|
|||||||
connector_webhook_details -> Nullable<Jsonb>,
|
connector_webhook_details -> Nullable<Jsonb>,
|
||||||
frm_config -> Nullable<Array<Nullable<Jsonb>>>,
|
frm_config -> Nullable<Array<Nullable<Jsonb>>>,
|
||||||
#[max_length = 64]
|
#[max_length = 64]
|
||||||
profile_id -> Varchar,
|
profile_id -> Nullable<Varchar>,
|
||||||
applepay_verified_domains -> Nullable<Array<Nullable<Text>>>,
|
applepay_verified_domains -> Nullable<Array<Nullable<Text>>>,
|
||||||
pm_auth_config -> Nullable<Jsonb>,
|
pm_auth_config -> Nullable<Jsonb>,
|
||||||
status -> ConnectorStatus,
|
status -> ConnectorStatus,
|
||||||
@ -853,7 +853,7 @@ diesel::table! {
|
|||||||
surcharge_amount -> Nullable<Int8>,
|
surcharge_amount -> Nullable<Int8>,
|
||||||
#[max_length = 64]
|
#[max_length = 64]
|
||||||
payment_method_id -> Nullable<Varchar>,
|
payment_method_id -> Nullable<Varchar>,
|
||||||
authentication_type -> AuthenticationType,
|
authentication_type -> Nullable<AuthenticationType>,
|
||||||
created_at -> Timestamp,
|
created_at -> Timestamp,
|
||||||
modified_at -> Timestamp,
|
modified_at -> Timestamp,
|
||||||
last_synced -> Nullable<Timestamp>,
|
last_synced -> Nullable<Timestamp>,
|
||||||
@ -884,7 +884,7 @@ diesel::table! {
|
|||||||
unified_code -> Nullable<Varchar>,
|
unified_code -> Nullable<Varchar>,
|
||||||
#[max_length = 1024]
|
#[max_length = 1024]
|
||||||
unified_message -> Nullable<Varchar>,
|
unified_message -> Nullable<Varchar>,
|
||||||
net_amount -> Int8,
|
net_amount -> Nullable<Int8>,
|
||||||
external_three_ds_authentication_attempted -> Nullable<Bool>,
|
external_three_ds_authentication_attempted -> Nullable<Bool>,
|
||||||
#[max_length = 64]
|
#[max_length = 64]
|
||||||
authentication_connector -> Nullable<Varchar>,
|
authentication_connector -> Nullable<Varchar>,
|
||||||
@ -914,7 +914,9 @@ diesel::table! {
|
|||||||
processor_merchant_id -> Nullable<Varchar>,
|
processor_merchant_id -> Nullable<Varchar>,
|
||||||
#[max_length = 255]
|
#[max_length = 255]
|
||||||
created_by -> Nullable<Varchar>,
|
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]
|
#[max_length = 128]
|
||||||
connector_payment_id -> Nullable<Varchar>,
|
connector_payment_id -> Nullable<Varchar>,
|
||||||
#[max_length = 64]
|
#[max_length = 64]
|
||||||
@ -936,8 +938,6 @@ diesel::table! {
|
|||||||
#[max_length = 32]
|
#[max_length = 32]
|
||||||
network_decline_code -> Nullable<Varchar>,
|
network_decline_code -> Nullable<Varchar>,
|
||||||
network_error_message -> Nullable<Text>,
|
network_error_message -> Nullable<Text>,
|
||||||
#[max_length = 255]
|
|
||||||
connector_request_reference_id -> Nullable<Varchar>,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -950,7 +950,7 @@ diesel::table! {
|
|||||||
merchant_id -> Varchar,
|
merchant_id -> Varchar,
|
||||||
status -> IntentStatus,
|
status -> IntentStatus,
|
||||||
amount -> Int8,
|
amount -> Int8,
|
||||||
currency -> Currency,
|
currency -> Nullable<Currency>,
|
||||||
amount_captured -> Nullable<Int8>,
|
amount_captured -> Nullable<Int8>,
|
||||||
#[max_length = 64]
|
#[max_length = 64]
|
||||||
customer_id -> Nullable<Varchar>,
|
customer_id -> Nullable<Varchar>,
|
||||||
@ -971,7 +971,7 @@ diesel::table! {
|
|||||||
feature_metadata -> Nullable<Json>,
|
feature_metadata -> Nullable<Json>,
|
||||||
attempt_count -> Int2,
|
attempt_count -> Int2,
|
||||||
#[max_length = 64]
|
#[max_length = 64]
|
||||||
profile_id -> Varchar,
|
profile_id -> Nullable<Varchar>,
|
||||||
#[max_length = 255]
|
#[max_length = 255]
|
||||||
payment_link_id -> Nullable<Varchar>,
|
payment_link_id -> Nullable<Varchar>,
|
||||||
#[max_length = 32]
|
#[max_length = 32]
|
||||||
@ -979,7 +979,7 @@ diesel::table! {
|
|||||||
surcharge_applicable -> Nullable<Bool>,
|
surcharge_applicable -> Nullable<Bool>,
|
||||||
request_incremental_authorization -> Nullable<RequestIncrementalAuthorization>,
|
request_incremental_authorization -> Nullable<RequestIncrementalAuthorization>,
|
||||||
authorization_count -> Nullable<Int4>,
|
authorization_count -> Nullable<Int4>,
|
||||||
session_expiry -> Timestamp,
|
session_expiry -> Nullable<Timestamp>,
|
||||||
request_external_three_ds_authentication -> Nullable<Bool>,
|
request_external_three_ds_authentication -> Nullable<Bool>,
|
||||||
frm_metadata -> Nullable<Jsonb>,
|
frm_metadata -> Nullable<Jsonb>,
|
||||||
customer_details -> Nullable<Bytea>,
|
customer_details -> Nullable<Bytea>,
|
||||||
@ -1272,7 +1272,7 @@ diesel::table! {
|
|||||||
#[max_length = 64]
|
#[max_length = 64]
|
||||||
id -> Varchar,
|
id -> Varchar,
|
||||||
#[max_length = 64]
|
#[max_length = 64]
|
||||||
merchant_reference_id -> Varchar,
|
merchant_reference_id -> Nullable<Varchar>,
|
||||||
#[max_length = 64]
|
#[max_length = 64]
|
||||||
connector_id -> Nullable<Varchar>,
|
connector_id -> Nullable<Varchar>,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,2 @@
|
|||||||
|
-- This file should undo anything in `up.sql`
|
||||||
|
DROP INDEX IF EXISTS payment_attempt_payment_id_index;
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
-- Your SQL goes here
|
||||||
|
CREATE INDEX IF NOT EXISTS payment_attempt_payment_id_index ON payment_attempt (payment_id);
|
||||||
@ -0,0 +1 @@
|
|||||||
|
DROP INDEX IF EXISTS merchant_connector_account_profile_id_index;
|
||||||
@ -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);
|
||||||
@ -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;
|
|
||||||
@ -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;
|
|
||||||
@ -38,8 +38,6 @@ UPDATE merchant_connector_account
|
|||||||
SET merchant_connector_id = id
|
SET merchant_connector_id = id
|
||||||
WHERE merchant_connector_id IS NULL;
|
WHERE merchant_connector_id IS NULL;
|
||||||
|
|
||||||
DROP INDEX IF EXISTS merchant_connector_account_profile_id_index;
|
|
||||||
|
|
||||||
------------------------ Customers -----------------------
|
------------------------ Customers -----------------------
|
||||||
-- Run this query only when V1 is deprecated
|
-- Run this query only when V1 is deprecated
|
||||||
ALTER TABLE customers DROP CONSTRAINT customers_pkey;
|
ALTER TABLE customers DROP CONSTRAINT customers_pkey;
|
||||||
|
|||||||
@ -48,10 +48,6 @@ WHERE id IS NULL;
|
|||||||
ALTER TABLE merchant_connector_account
|
ALTER TABLE merchant_connector_account
|
||||||
ADD PRIMARY KEY (id);
|
ADD 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 -----------------------
|
------------------------ Customers -----------------------
|
||||||
-- Backfill id column with customer_id values
|
-- Backfill id column with customer_id values
|
||||||
UPDATE customers
|
UPDATE customers
|
||||||
|
|||||||
@ -136,5 +136,3 @@ ALTER TABLE refund
|
|||||||
ADD COLUMN IF NOT EXISTS internal_reference_id VARCHAR(64),
|
ADD COLUMN IF NOT EXISTS internal_reference_id VARCHAR(64),
|
||||||
ADD COLUMN IF NOT EXISTS refund_id VARCHAR(64),
|
ADD COLUMN IF NOT EXISTS refund_id VARCHAR(64),
|
||||||
ADD COLUMN IF NOT EXISTS merchant_connector_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);
|
|
||||||
@ -130,8 +130,3 @@ ALTER TABLE refund
|
|||||||
DROP COLUMN IF EXISTS internal_reference_id,
|
DROP COLUMN IF EXISTS internal_reference_id,
|
||||||
DROP COLUMN IF EXISTS refund_id,
|
DROP COLUMN IF EXISTS refund_id,
|
||||||
DROP COLUMN IF EXISTS merchant_connector_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;
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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);
|
|
||||||
@ -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);
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
-- This file should undo anything in `up.sql`
|
|
||||||
ALTER TABLE payment_attempt DROP COLUMN IF EXISTS connector_request_reference_id;
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
-- Your SQL goes here
|
|
||||||
ALTER TABLE payment_attempt ADD COLUMN IF NOT EXISTS connector_request_reference_id VARCHAR(255);
|
|
||||||
Reference in New Issue
Block a user