refactor: shrink sizes of VARCHAR columns and rename some columns (#188)

This commit is contained in:
Sanchith Hegde
2022-12-22 12:27:59 +05:30
committed by GitHub
parent 349036bff3
commit 60f076f1c3
26 changed files with 323 additions and 97 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
* text=auto

View File

@ -82,7 +82,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsCancelRequest>
.await?; .await?;
let connector_response = db let connector_response = db
.find_connector_response_by_payment_id_merchant_id_txn_id( .find_connector_response_by_payment_id_merchant_id_attempt_id(
&payment_attempt.payment_id, &payment_attempt.payment_id,
&payment_attempt.merchant_id, &payment_attempt.merchant_id,
&payment_attempt.attempt_id, &payment_attempt.attempt_id,

View File

@ -86,7 +86,7 @@ impl<F: Send + Clone> GetTracker<F, payments::PaymentData<F>, api::PaymentsCaptu
amount = payment_attempt.amount.into(); amount = payment_attempt.amount.into();
let connector_response = db let connector_response = db
.find_connector_response_by_payment_id_merchant_id_txn_id( .find_connector_response_by_payment_id_merchant_id_attempt_id(
&payment_attempt.payment_id, &payment_attempt.payment_id,
&payment_attempt.merchant_id, &payment_attempt.merchant_id,
&payment_attempt.attempt_id, &payment_attempt.attempt_id,

View File

@ -94,7 +94,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
amount = payment_attempt.amount.into(); amount = payment_attempt.amount.into();
connector_response = db connector_response = db
.find_connector_response_by_payment_id_merchant_id_txn_id( .find_connector_response_by_payment_id_merchant_id_attempt_id(
&payment_attempt.payment_id, &payment_attempt.payment_id,
&payment_attempt.merchant_id, &payment_attempt.merchant_id,
&payment_attempt.attempt_id, &payment_attempt.attempt_id,

View File

@ -503,7 +503,7 @@ impl PaymentCreate {
storage::ConnectorResponseNew { storage::ConnectorResponseNew {
payment_id: payment_attempt.payment_id.clone(), payment_id: payment_attempt.payment_id.clone(),
merchant_id: payment_attempt.merchant_id.clone(), merchant_id: payment_attempt.merchant_id.clone(),
txn_id: payment_attempt.attempt_id.clone(), attempt_id: payment_attempt.attempt_id.clone(),
created_at: payment_attempt.created_at, created_at: payment_attempt.created_at,
modified_at: payment_attempt.modified_at, modified_at: payment_attempt.modified_at,
connector_name: payment_attempt.connector.clone(), connector_name: payment_attempt.connector.clone(),

View File

@ -103,7 +103,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsSessionRequest>
let db = db as &dyn StorageInterface; let db = db as &dyn StorageInterface;
let connector_response = db let connector_response = db
.find_connector_response_by_payment_id_merchant_id_txn_id( .find_connector_response_by_payment_id_merchant_id_attempt_id(
&payment_intent.payment_id, &payment_intent.payment_id,
&payment_intent.merchant_id, &payment_intent.merchant_id,
&payment_attempt.attempt_id, &payment_attempt.attempt_id,

View File

@ -100,7 +100,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsStartRequest> f
}; };
let connector_response = db let connector_response = db
.find_connector_response_by_payment_id_merchant_id_txn_id( .find_connector_response_by_payment_id_merchant_id_attempt_id(
&payment_intent.payment_id, &payment_intent.payment_id,
&payment_intent.merchant_id, &payment_intent.merchant_id,
&payment_attempt.attempt_id, &payment_attempt.attempt_id,

View File

@ -230,7 +230,7 @@ async fn get_tracker_for_sync<
.map_err(|error| error.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound))?; .map_err(|error| error.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound))?;
let mut connector_response = db let mut connector_response = db
.find_connector_response_by_payment_id_merchant_id_txn_id( .find_connector_response_by_payment_id_merchant_id_attempt_id(
&payment_intent.payment_id, &payment_intent.payment_id,
&payment_intent.merchant_id, &payment_intent.merchant_id,
&payment_attempt.attempt_id, &payment_attempt.attempt_id,

View File

@ -113,7 +113,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
let db = db as &dyn StorageInterface; let db = db as &dyn StorageInterface;
let connector_response = db let connector_response = db
.find_connector_response_by_payment_id_merchant_id_txn_id( .find_connector_response_by_payment_id_merchant_id_attempt_id(
&payment_intent.payment_id, &payment_intent.payment_id,
&payment_intent.merchant_id, &payment_intent.merchant_id,
&payment_attempt.attempt_id, &payment_attempt.attempt_id,

View File

@ -145,7 +145,7 @@ pub async fn trigger_refund_to_gateway(
refund_error_message: Some(err.message), refund_error_message: Some(err.message),
}, },
Ok(response) => storage::RefundUpdate::Update { Ok(response) => storage::RefundUpdate::Update {
pg_refund_id: response.connector_refund_id, connector_refund_id: response.connector_refund_id,
refund_status: response.refund_status, refund_status: response.refund_status,
sent_to_gateway: true, sent_to_gateway: true,
refund_error_message: None, refund_error_message: None,
@ -214,8 +214,8 @@ pub async fn refund_retrieve_core(
.map_err(|error| error.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound))?; .map_err(|error| error.to_not_found_response(errors::ApiErrorResponse::PaymentNotFound))?;
payment_attempt = db payment_attempt = db
.find_payment_attempt_by_transaction_id_payment_id_merchant_id( .find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
&refund.transaction_id, &refund.connector_transaction_id,
payment_id, payment_id,
merchant_id, merchant_id,
merchant_account.storage_scheme, merchant_account.storage_scheme,
@ -286,7 +286,7 @@ pub async fn sync_refund_with_gateway(
refund_error_message: Some(error_message.message), refund_error_message: Some(error_message.message),
}, },
Ok(response) => storage::RefundUpdate::Update { Ok(response) => storage::RefundUpdate::Update {
pg_refund_id: response.connector_refund_id, connector_refund_id: response.connector_refund_id,
refund_status: response.refund_status, refund_status: response.refund_status,
sent_to_gateway: true, sent_to_gateway: true,
refund_error_message: None, refund_error_message: None,
@ -390,7 +390,7 @@ pub async fn validate_and_create_refund(
}; };
all_refunds = db all_refunds = db
.find_refund_by_merchant_id_transaction_id( .find_refund_by_merchant_id_connector_transaction_id(
&merchant_account.merchant_id, &merchant_account.merchant_id,
connecter_transaction_id, connecter_transaction_id,
merchant_account.storage_scheme, merchant_account.storage_scheme,
@ -479,7 +479,7 @@ fn mk_new_refund(
payment_id: request.payment_id, payment_id: request.payment_id,
merchant_id: merchant_id.to_string(), merchant_id: merchant_id.to_string(),
// FIXME: remove the default. // FIXME: remove the default.
transaction_id: connecter_transaction_id.to_string(), connector_transaction_id: connecter_transaction_id.to_string(),
connector, connector,
refund_type: enums::RefundType::RegularRefund, refund_type: enums::RefundType::RegularRefund,
total_amount: refund_amount, total_amount: refund_amount,
@ -738,8 +738,8 @@ pub async fn trigger_refund_execute_workflow(
})?; })?;
let payment_attempt = db let payment_attempt = db
.find_payment_attempt_by_transaction_id_payment_id_merchant_id( .find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
&refund.transaction_id, &refund.connector_transaction_id,
&refund_core.payment_id, &refund_core.payment_id,
&refund.merchant_id, &refund.merchant_id,
merchant_account.storage_scheme, merchant_account.storage_scheme,
@ -793,7 +793,7 @@ pub fn refund_to_refund_core_workflow_model(
) -> storage::RefundCoreWorkflow { ) -> storage::RefundCoreWorkflow {
storage::RefundCoreWorkflow { storage::RefundCoreWorkflow {
refund_internal_reference_id: refund.internal_reference_id.clone(), refund_internal_reference_id: refund.internal_reference_id.clone(),
transaction_id: refund.transaction_id.clone(), connector_transaction_id: refund.connector_transaction_id.clone(),
merchant_id: refund.merchant_id.clone(), merchant_id: refund.merchant_id.clone(),
payment_id: refund.payment_id.clone(), payment_id: refund.payment_id.clone(),
} }

View File

@ -78,14 +78,14 @@ pub async fn construct_refund_router_data<'a, F>(
request: types::RefundsData { request: types::RefundsData {
refund_id: refund.refund_id.clone(), refund_id: refund.refund_id.clone(),
payment_method_data, payment_method_data,
connector_transaction_id: refund.transaction_id.clone(), connector_transaction_id: refund.connector_transaction_id.clone(),
refund_amount: refund.refund_amount, refund_amount: refund.refund_amount,
currency, currency,
amount, amount,
}, },
response: Ok(types::RefundsResponseData { response: Ok(types::RefundsResponseData {
connector_refund_id: refund.pg_refund_id.clone().unwrap_or_default(), connector_refund_id: refund.connector_refund_id.clone().unwrap_or_default(),
refund_status: refund.refund_status, refund_status: refund.refund_status,
}), }),
}; };

View File

@ -15,11 +15,11 @@ pub trait ConnectorResponseInterface {
storage_scheme: enums::MerchantStorageScheme, storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<storage::ConnectorResponse, errors::StorageError>; ) -> CustomResult<storage::ConnectorResponse, errors::StorageError>;
async fn find_connector_response_by_payment_id_merchant_id_txn_id( async fn find_connector_response_by_payment_id_merchant_id_attempt_id(
&self, &self,
payment_id: &str, payment_id: &str,
merchant_id: &str, merchant_id: &str,
txn_id: &str, attempt_id: &str,
storage_scheme: enums::MerchantStorageScheme, storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<storage::ConnectorResponse, errors::StorageError>; ) -> CustomResult<storage::ConnectorResponse, errors::StorageError>;
@ -46,19 +46,19 @@ impl ConnectorResponseInterface for Store {
.into_report() .into_report()
} }
async fn find_connector_response_by_payment_id_merchant_id_txn_id( async fn find_connector_response_by_payment_id_merchant_id_attempt_id(
&self, &self,
payment_id: &str, payment_id: &str,
merchant_id: &str, merchant_id: &str,
txn_id: &str, attempt_id: &str,
_storage_scheme: enums::MerchantStorageScheme, _storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<storage::ConnectorResponse, errors::StorageError> { ) -> CustomResult<storage::ConnectorResponse, errors::StorageError> {
let conn = pg_connection(&self.master_pool).await; let conn = pg_connection(&self.master_pool).await;
storage::ConnectorResponse::find_by_payment_id_and_merchant_id_transaction_id( storage::ConnectorResponse::find_by_payment_id_merchant_id_attempt_id(
&conn, &conn,
payment_id, payment_id,
merchant_id, merchant_id,
txn_id, attempt_id,
) )
.await .await
.map_err(Into::into) .map_err(Into::into)
@ -91,7 +91,7 @@ impl ConnectorResponseInterface for MockDb {
id: connector_response.len() as i32, id: connector_response.len() as i32,
payment_id: new.payment_id, payment_id: new.payment_id,
merchant_id: new.merchant_id, merchant_id: new.merchant_id,
txn_id: new.txn_id, attempt_id: new.attempt_id,
created_at: new.created_at, created_at: new.created_at,
modified_at: new.modified_at, modified_at: new.modified_at,
connector_name: new.connector_name, connector_name: new.connector_name,
@ -103,11 +103,11 @@ impl ConnectorResponseInterface for MockDb {
Ok(response) Ok(response)
} }
async fn find_connector_response_by_payment_id_merchant_id_txn_id( async fn find_connector_response_by_payment_id_merchant_id_attempt_id(
&self, &self,
_payment_id: &str, _payment_id: &str,
_merchant_id: &str, _merchant_id: &str,
_txn_id: &str, _attempt_id: &str,
_storage_scheme: enums::MerchantStorageScheme, _storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<storage::ConnectorResponse, errors::StorageError> { ) -> CustomResult<storage::ConnectorResponse, errors::StorageError> {
// [#172]: Implement function for `MockDb` // [#172]: Implement function for `MockDb`

View File

@ -26,9 +26,9 @@ pub trait PaymentAttemptInterface {
storage_scheme: enums::MerchantStorageScheme, storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<types::PaymentAttempt, errors::StorageError>; ) -> CustomResult<types::PaymentAttempt, errors::StorageError>;
async fn find_payment_attempt_by_transaction_id_payment_id_merchant_id( async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
&self, &self,
transaction_id: &str, connector_transaction_id: &str,
payment_id: &str, payment_id: &str,
merchant_id: &str, merchant_id: &str,
storage_scheme: enums::MerchantStorageScheme, storage_scheme: enums::MerchantStorageScheme,
@ -109,17 +109,17 @@ mod storage {
.into_report() .into_report()
} }
async fn find_payment_attempt_by_transaction_id_payment_id_merchant_id( async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
&self, &self,
transaction_id: &str, connector_transaction_id: &str,
payment_id: &str, payment_id: &str,
merchant_id: &str, merchant_id: &str,
_storage_scheme: enums::MerchantStorageScheme, _storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, errors::StorageError> { ) -> CustomResult<PaymentAttempt, errors::StorageError> {
let conn = pg_connection(&self.master_pool).await; let conn = pg_connection(&self.master_pool).await;
PaymentAttempt::find_by_transaction_id_payment_id_merchant_id( PaymentAttempt::find_by_connector_transaction_id_payment_id_merchant_id(
&conn, &conn,
transaction_id, connector_transaction_id,
payment_id, payment_id,
merchant_id, merchant_id,
) )
@ -277,9 +277,9 @@ impl PaymentAttemptInterface for MockDb {
Err(errors::StorageError::MockDbError)? Err(errors::StorageError::MockDbError)?
} }
async fn find_payment_attempt_by_transaction_id_payment_id_merchant_id( async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
&self, &self,
_transaction_id: &str, _connector_transaction_id: &str,
_payment_id: &str, _payment_id: &str,
_merchant_id: &str, _merchant_id: &str,
_storage_scheme: enums::MerchantStorageScheme, _storage_scheme: enums::MerchantStorageScheme,
@ -560,15 +560,15 @@ mod storage {
} }
} }
async fn find_payment_attempt_by_transaction_id_payment_id_merchant_id( async fn find_payment_attempt_by_connector_transaction_id_payment_id_merchant_id(
&self, &self,
transaction_id: &str, connector_transaction_id: &str,
_payment_id: &str, _payment_id: &str,
merchant_id: &str, merchant_id: &str,
_storage_scheme: enums::MerchantStorageScheme, _storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<PaymentAttempt, errors::StorageError> { ) -> CustomResult<PaymentAttempt, errors::StorageError> {
// We assume that PaymentAttempt <=> PaymentIntent is a one-to-one relation for now // We assume that PaymentAttempt <=> PaymentIntent is a one-to-one relation for now
let lookup_id = format!("{merchant_id}_{transaction_id}"); let lookup_id = format!("{merchant_id}_{connector_transaction_id}");
let lookup = self let lookup = self
.get_lookup_by_lookup_id(&lookup_id) .get_lookup_by_lookup_id(&lookup_id)
.await .await

View File

@ -44,10 +44,10 @@ pub trait RefundInterface {
storage_scheme: enums::MerchantStorageScheme, storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<storage_types::Refund, errors::StorageError>; ) -> CustomResult<storage_types::Refund, errors::StorageError>;
async fn find_refund_by_merchant_id_transaction_id( async fn find_refund_by_merchant_id_connector_transaction_id(
&self, &self,
merchant_id: &str, merchant_id: &str,
txn_id: &str, connector_transaction_id: &str,
storage_scheme: enums::MerchantStorageScheme, storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<Vec<storage_types::Refund>, errors::StorageError>; ) -> CustomResult<Vec<storage_types::Refund>, errors::StorageError>;
@ -98,17 +98,21 @@ mod storage {
new.insert(&conn).await.map_err(Into::into).into_report() new.insert(&conn).await.map_err(Into::into).into_report()
} }
async fn find_refund_by_merchant_id_transaction_id( async fn find_refund_by_merchant_id_connector_transaction_id(
&self, &self,
merchant_id: &str, merchant_id: &str,
txn_id: &str, connector_transaction_id: &str,
_storage_scheme: enums::MerchantStorageScheme, _storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<Vec<storage_types::Refund>, errors::StorageError> { ) -> CustomResult<Vec<storage_types::Refund>, errors::StorageError> {
let conn = pg_connection(&self.master_pool).await; let conn = pg_connection(&self.master_pool).await;
storage_types::Refund::find_by_merchant_id_transaction_id(&conn, merchant_id, txn_id) storage_types::Refund::find_by_merchant_id_connector_transaction_id(
.await &conn,
.map_err(Into::into) merchant_id,
.into_report() connector_transaction_id,
)
.await
.map_err(Into::into)
.into_report()
} }
async fn update_refund( async fn update_refund(
@ -244,9 +248,9 @@ mod storage {
attempt_id: new.attempt_id.clone(), attempt_id: new.attempt_id.clone(),
internal_reference_id: new.internal_reference_id.clone(), internal_reference_id: new.internal_reference_id.clone(),
payment_id: new.payment_id.clone(), payment_id: new.payment_id.clone(),
transaction_id: new.transaction_id.clone(), connector_transaction_id: new.connector_transaction_id.clone(),
connector: new.connector.clone(), connector: new.connector.clone(),
pg_refund_id: new.pg_refund_id.clone(), connector_refund_id: new.connector_refund_id.clone(),
external_reference_id: new.external_reference_id.clone(), external_reference_id: new.external_reference_id.clone(),
refund_type: new.refund_type, refund_type: new.refund_type,
total_amount: new.total_amount, total_amount: new.total_amount,
@ -295,7 +299,8 @@ mod storage {
sk_id: field.clone(), sk_id: field.clone(),
lookup_id: format!( lookup_id: format!(
"{}_{}", "{}_{}",
created_refund.merchant_id, created_refund.transaction_id created_refund.merchant_id,
created_refund.connector_transaction_id
), ),
pk_id: key.clone(), pk_id: key.clone(),
source: "refund".to_string(), source: "refund".to_string(),
@ -347,26 +352,26 @@ mod storage {
} }
} }
async fn find_refund_by_merchant_id_transaction_id( async fn find_refund_by_merchant_id_connector_transaction_id(
&self, &self,
merchant_id: &str, merchant_id: &str,
txn_id: &str, connector_transaction_id: &str,
storage_scheme: enums::MerchantStorageScheme, storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<Vec<storage_types::Refund>, errors::StorageError> { ) -> CustomResult<Vec<storage_types::Refund>, errors::StorageError> {
match storage_scheme { match storage_scheme {
enums::MerchantStorageScheme::PostgresOnly => { enums::MerchantStorageScheme::PostgresOnly => {
let conn = pg_connection(&self.master_pool).await; let conn = pg_connection(&self.master_pool).await;
storage_types::Refund::find_by_merchant_id_transaction_id( storage_types::Refund::find_by_merchant_id_connector_transaction_id(
&conn, &conn,
merchant_id, merchant_id,
txn_id, connector_transaction_id,
) )
.await .await
.map_err(Into::into) .map_err(Into::into)
.into_report() .into_report()
} }
enums::MerchantStorageScheme::RedisKv => { enums::MerchantStorageScheme::RedisKv => {
let lookup_id = format!("{merchant_id}_{txn_id}"); let lookup_id = format!("{merchant_id}_{connector_transaction_id}");
let lookup = match self.get_lookup_by_lookup_id(&lookup_id).await { let lookup = match self.get_lookup_by_lookup_id(&lookup_id).await {
Ok(l) => l, Ok(l) => l,
Err(err) => { Err(err) => {
@ -572,9 +577,9 @@ impl RefundInterface for MockDb {
payment_id: new.payment_id, payment_id: new.payment_id,
merchant_id: new.merchant_id, merchant_id: new.merchant_id,
attempt_id: new.attempt_id, attempt_id: new.attempt_id,
transaction_id: new.transaction_id, connector_transaction_id: new.connector_transaction_id,
connector: new.connector, connector: new.connector,
pg_refund_id: new.pg_refund_id, connector_refund_id: new.connector_refund_id,
external_reference_id: new.external_reference_id, external_reference_id: new.external_reference_id,
refund_type: new.refund_type, refund_type: new.refund_type,
total_amount: new.total_amount, total_amount: new.total_amount,
@ -592,10 +597,10 @@ impl RefundInterface for MockDb {
refunds.push(refund.clone()); refunds.push(refund.clone());
Ok(refund) Ok(refund)
} }
async fn find_refund_by_merchant_id_transaction_id( async fn find_refund_by_merchant_id_connector_transaction_id(
&self, &self,
merchant_id: &str, merchant_id: &str,
txn_id: &str, connector_transaction_id: &str,
_storage_scheme: enums::MerchantStorageScheme, _storage_scheme: enums::MerchantStorageScheme,
) -> CustomResult<Vec<storage_types::Refund>, errors::StorageError> { ) -> CustomResult<Vec<storage_types::Refund>, errors::StorageError> {
let refunds = self.refunds.lock().await; let refunds = self.refunds.lock().await;
@ -603,7 +608,8 @@ impl RefundInterface for MockDb {
Ok(refunds Ok(refunds
.iter() .iter()
.take_while(|refund| { .take_while(|refund| {
refund.merchant_id == merchant_id && refund.transaction_id == txn_id refund.merchant_id == merchant_id
&& refund.connector_transaction_id == connector_transaction_id
}) })
.cloned() .cloned()
.collect::<Vec<_>>()) .collect::<Vec<_>>())

View File

@ -10,7 +10,7 @@ use crate::schema::connector_response;
pub struct ConnectorResponseNew { pub struct ConnectorResponseNew {
pub payment_id: String, pub payment_id: String,
pub merchant_id: String, pub merchant_id: String,
pub txn_id: String, pub attempt_id: String,
pub created_at: PrimitiveDateTime, pub created_at: PrimitiveDateTime,
pub modified_at: PrimitiveDateTime, pub modified_at: PrimitiveDateTime,
pub connector_name: Option<String>, pub connector_name: Option<String>,
@ -26,7 +26,7 @@ pub struct ConnectorResponse {
pub id: i32, pub id: i32,
pub payment_id: String, pub payment_id: String,
pub merchant_id: String, pub merchant_id: String,
pub txn_id: String, pub attempt_id: String,
pub created_at: PrimitiveDateTime, pub created_at: PrimitiveDateTime,
pub modified_at: PrimitiveDateTime, pub modified_at: PrimitiveDateTime,
pub connector_name: Option<String>, pub connector_name: Option<String>,

View File

@ -19,7 +19,7 @@ pub struct Mandate {
pub customer_ip_address: Option<Secret<String, pii::IpAddress>>, pub customer_ip_address: Option<Secret<String, pii::IpAddress>>,
pub customer_user_agent: Option<String>, pub customer_user_agent: Option<String>,
pub network_transaction_id: Option<String>, pub network_transaction_id: Option<String>,
pub previous_transaction_id: Option<String>, pub previous_attempt_id: Option<String>,
pub created_at: PrimitiveDateTime, pub created_at: PrimitiveDateTime,
pub mandate_amount: Option<i64>, pub mandate_amount: Option<i64>,
pub mandate_currency: Option<storage_enums::Currency>, pub mandate_currency: Option<storage_enums::Currency>,
@ -43,7 +43,7 @@ pub struct MandateNew {
pub customer_ip_address: Option<Secret<String, pii::IpAddress>>, pub customer_ip_address: Option<Secret<String, pii::IpAddress>>,
pub customer_user_agent: Option<String>, pub customer_user_agent: Option<String>,
pub network_transaction_id: Option<String>, pub network_transaction_id: Option<String>,
pub previous_transaction_id: Option<String>, pub previous_attempt_id: Option<String>,
pub created_at: Option<PrimitiveDateTime>, pub created_at: Option<PrimitiveDateTime>,
pub mandate_amount: Option<i64>, pub mandate_amount: Option<i64>,
pub mandate_currency: Option<storage_enums::Currency>, pub mandate_currency: Option<storage_enums::Currency>,

View File

@ -23,7 +23,6 @@ pub struct PaymentMethod {
pub is_stored: Option<bool>, pub is_stored: Option<bool>,
pub swift_code: Option<String>, pub swift_code: Option<String>,
pub direct_debit_token: Option<String>, pub direct_debit_token: Option<String>,
pub network_transaction_id: Option<String>,
pub created_at: PrimitiveDateTime, pub created_at: PrimitiveDateTime,
pub last_modified: PrimitiveDateTime, pub last_modified: PrimitiveDateTime,
pub payment_method: storage_enums::PaymentMethodType, pub payment_method: storage_enums::PaymentMethodType,
@ -53,7 +52,6 @@ pub struct PaymentMethodNew {
pub is_stored: Option<bool>, pub is_stored: Option<bool>,
pub swift_code: Option<String>, pub swift_code: Option<String>,
pub direct_debit_token: Option<String>, pub direct_debit_token: Option<String>,
pub network_transaction_id: Option<String>,
pub created_at: PrimitiveDateTime, pub created_at: PrimitiveDateTime,
pub last_modified: PrimitiveDateTime, pub last_modified: PrimitiveDateTime,
pub metadata: Option<serde_json::Value>, pub metadata: Option<serde_json::Value>,
@ -81,7 +79,6 @@ impl Default for PaymentMethodNew {
is_stored: Option::default(), is_stored: Option::default(),
swift_code: Option::default(), swift_code: Option::default(),
direct_debit_token: Option::default(), direct_debit_token: Option::default(),
network_transaction_id: Option::default(),
created_at: now, created_at: now,
last_modified: now, last_modified: now,
metadata: Option::default(), metadata: Option::default(),

View File

@ -42,18 +42,18 @@ impl ConnectorResponse {
} }
#[instrument(skip(conn))] #[instrument(skip(conn))]
pub async fn find_by_payment_id_and_merchant_id_transaction_id( pub async fn find_by_payment_id_merchant_id_attempt_id(
conn: &PgPooledConn, conn: &PgPooledConn,
payment_id: &str, payment_id: &str,
merchant_id: &str, merchant_id: &str,
transaction_id: &str, attempt_id: &str,
) -> StorageResult<ConnectorResponse> { ) -> StorageResult<ConnectorResponse> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>( generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn, conn,
dsl::merchant_id.eq(merchant_id.to_owned()).and( dsl::merchant_id.eq(merchant_id.to_owned()).and(
dsl::payment_id dsl::payment_id
.eq(payment_id.to_owned()) .eq(payment_id.to_owned())
.and(dsl::txn_id.eq(transaction_id.to_owned())), .and(dsl::attempt_id.eq(attempt_id.to_owned())),
), ),
) )
.await .await

View File

@ -76,16 +76,16 @@ impl PaymentAttempt {
} }
#[instrument(skip(conn))] #[instrument(skip(conn))]
pub async fn find_by_transaction_id_payment_id_merchant_id( pub async fn find_by_connector_transaction_id_payment_id_merchant_id(
conn: &PgPooledConn, conn: &PgPooledConn,
transaction_id: &str, connector_transaction_id: &str,
payment_id: &str, payment_id: &str,
merchant_id: &str, merchant_id: &str,
) -> StorageResult<Self> { ) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>( generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn, conn,
dsl::connector_transaction_id dsl::connector_transaction_id
.eq(transaction_id.to_owned()) .eq(connector_transaction_id.to_owned())
.and(dsl::payment_id.eq(payment_id.to_owned())) .and(dsl::payment_id.eq(payment_id.to_owned()))
.and(dsl::merchant_id.eq(merchant_id.to_owned())), .and(dsl::merchant_id.eq(merchant_id.to_owned())),
) )

View File

@ -66,16 +66,16 @@ impl Refund {
} }
#[instrument(skip(conn))] #[instrument(skip(conn))]
pub async fn find_by_merchant_id_transaction_id( pub async fn find_by_merchant_id_connector_transaction_id(
conn: &PgPooledConn, conn: &PgPooledConn,
merchant_id: &str, merchant_id: &str,
txn_id: &str, connector_transaction_id: &str,
) -> StorageResult<Vec<Self>> { ) -> StorageResult<Vec<Self>> {
generics::generic_filter::<<Self as HasTable>::Table, _, _>( generics::generic_filter::<<Self as HasTable>::Table, _, _>(
conn, conn,
dsl::merchant_id dsl::merchant_id
.eq(merchant_id.to_owned()) .eq(merchant_id.to_owned())
.and(dsl::transaction_id.eq(txn_id.to_owned())), .and(dsl::connector_transaction_id.eq(connector_transaction_id.to_owned())),
None, None,
) )
.await .await

View File

@ -14,9 +14,9 @@ pub struct Refund {
pub refund_id: String, //merchant_reference id pub refund_id: String, //merchant_reference id
pub payment_id: String, pub payment_id: String,
pub merchant_id: String, pub merchant_id: String,
pub transaction_id: String, pub connector_transaction_id: String,
pub connector: String, pub connector: String,
pub pg_refund_id: Option<String>, pub connector_refund_id: Option<String>,
pub external_reference_id: Option<String>, pub external_reference_id: Option<String>,
pub refund_type: storage_enums::RefundType, pub refund_type: storage_enums::RefundType,
pub total_amount: i64, pub total_amount: i64,
@ -51,9 +51,9 @@ pub struct RefundNew {
pub merchant_id: String, pub merchant_id: String,
pub internal_reference_id: String, pub internal_reference_id: String,
pub external_reference_id: Option<String>, pub external_reference_id: Option<String>,
pub transaction_id: String, pub connector_transaction_id: String,
pub connector: String, pub connector: String,
pub pg_refund_id: Option<String>, pub connector_refund_id: Option<String>,
pub refund_type: storage_enums::RefundType, pub refund_type: storage_enums::RefundType,
pub total_amount: i64, pub total_amount: i64,
pub currency: storage_enums::Currency, pub currency: storage_enums::Currency,
@ -72,7 +72,7 @@ pub struct RefundNew {
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub enum RefundUpdate { pub enum RefundUpdate {
Update { Update {
pg_refund_id: String, connector_refund_id: String,
refund_status: storage_enums::RefundStatus, refund_status: storage_enums::RefundStatus,
sent_to_gateway: bool, sent_to_gateway: bool,
refund_error_message: Option<String>, refund_error_message: Option<String>,
@ -82,7 +82,7 @@ pub enum RefundUpdate {
metadata: Option<serde_json::Value>, metadata: Option<serde_json::Value>,
}, },
StatusUpdate { StatusUpdate {
pg_refund_id: Option<String>, connector_refund_id: Option<String>,
sent_to_gateway: bool, sent_to_gateway: bool,
refund_status: storage_enums::RefundStatus, refund_status: storage_enums::RefundStatus,
}, },
@ -95,7 +95,7 @@ pub enum RefundUpdate {
#[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)] #[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
#[diesel(table_name = refund)] #[diesel(table_name = refund)]
pub struct RefundUpdateInternal { pub struct RefundUpdateInternal {
pg_refund_id: Option<String>, connector_refund_id: Option<String>,
refund_status: Option<storage_enums::RefundStatus>, refund_status: Option<storage_enums::RefundStatus>,
sent_to_gateway: Option<bool>, sent_to_gateway: Option<bool>,
refund_error_message: Option<String>, refund_error_message: Option<String>,
@ -107,13 +107,13 @@ impl From<RefundUpdate> for RefundUpdateInternal {
fn from(refund_update: RefundUpdate) -> Self { fn from(refund_update: RefundUpdate) -> Self {
match refund_update { match refund_update {
RefundUpdate::Update { RefundUpdate::Update {
pg_refund_id, connector_refund_id,
refund_status, refund_status,
sent_to_gateway, sent_to_gateway,
refund_error_message, refund_error_message,
refund_arn, refund_arn,
} => Self { } => Self {
pg_refund_id: Some(pg_refund_id), connector_refund_id: Some(connector_refund_id),
refund_status: Some(refund_status), refund_status: Some(refund_status),
sent_to_gateway: Some(sent_to_gateway), sent_to_gateway: Some(sent_to_gateway),
refund_error_message, refund_error_message,
@ -125,11 +125,11 @@ impl From<RefundUpdate> for RefundUpdateInternal {
..Default::default() ..Default::default()
}, },
RefundUpdate::StatusUpdate { RefundUpdate::StatusUpdate {
pg_refund_id, connector_refund_id,
sent_to_gateway, sent_to_gateway,
refund_status, refund_status,
} => Self { } => Self {
pg_refund_id, connector_refund_id,
sent_to_gateway: Some(sent_to_gateway), sent_to_gateway: Some(sent_to_gateway),
refund_status: Some(refund_status), refund_status: Some(refund_status),
..Default::default() ..Default::default()
@ -150,7 +150,7 @@ impl RefundUpdate {
pub fn apply_changeset(self, source: Refund) -> Refund { pub fn apply_changeset(self, source: Refund) -> Refund {
let pa_update: RefundUpdateInternal = self.into(); let pa_update: RefundUpdateInternal = self.into();
Refund { Refund {
pg_refund_id: pa_update.pg_refund_id, connector_refund_id: pa_update.connector_refund_id,
refund_status: pa_update.refund_status.unwrap_or(source.refund_status), refund_status: pa_update.refund_status.unwrap_or(source.refund_status),
sent_to_gateway: pa_update.sent_to_gateway.unwrap_or(source.sent_to_gateway), sent_to_gateway: pa_update.sent_to_gateway.unwrap_or(source.sent_to_gateway),
refund_error_message: pa_update.refund_error_message, refund_error_message: pa_update.refund_error_message,
@ -164,7 +164,7 @@ impl RefundUpdate {
#[derive(Debug, Eq, PartialEq, Deserialize, Serialize)] #[derive(Debug, Eq, PartialEq, Deserialize, Serialize)]
pub struct RefundCoreWorkflow { pub struct RefundCoreWorkflow {
pub refund_internal_reference_id: String, pub refund_internal_reference_id: String,
pub transaction_id: String, pub connector_transaction_id: String,
pub merchant_id: String, pub merchant_id: String,
pub payment_id: String, pub payment_id: String,
} }

View File

@ -44,7 +44,7 @@ diesel::table! {
id -> Int4, id -> Int4,
payment_id -> Varchar, payment_id -> Varchar,
merchant_id -> Varchar, merchant_id -> Varchar,
txn_id -> Varchar, attempt_id -> Varchar,
created_at -> Timestamp, created_at -> Timestamp,
modified_at -> Timestamp, modified_at -> Timestamp,
connector_name -> Nullable<Varchar>, connector_name -> Nullable<Varchar>,
@ -127,7 +127,7 @@ diesel::table! {
customer_ip_address -> Nullable<Varchar>, customer_ip_address -> Nullable<Varchar>,
customer_user_agent -> Nullable<Varchar>, customer_user_agent -> Nullable<Varchar>,
network_transaction_id -> Nullable<Varchar>, network_transaction_id -> Nullable<Varchar>,
previous_transaction_id -> Nullable<Varchar>, previous_attempt_id -> Nullable<Varchar>,
created_at -> Timestamp, created_at -> Timestamp,
mandate_amount -> Nullable<Int8>, mandate_amount -> Nullable<Int8>,
mandate_currency -> Nullable<Currency>, mandate_currency -> Nullable<Currency>,
@ -267,7 +267,6 @@ diesel::table! {
is_stored -> Nullable<Bool>, is_stored -> Nullable<Bool>,
swift_code -> Nullable<Varchar>, swift_code -> Nullable<Varchar>,
direct_debit_token -> Nullable<Varchar>, direct_debit_token -> Nullable<Varchar>,
network_transaction_id -> Nullable<Varchar>,
created_at -> Timestamp, created_at -> Timestamp,
last_modified -> Timestamp, last_modified -> Timestamp,
payment_method -> PaymentMethodType, payment_method -> PaymentMethodType,
@ -309,9 +308,9 @@ diesel::table! {
refund_id -> Varchar, refund_id -> Varchar,
payment_id -> Varchar, payment_id -> Varchar,
merchant_id -> Varchar, merchant_id -> Varchar,
transaction_id -> Varchar, connector_transaction_id -> Varchar,
connector -> Varchar, connector -> Varchar,
pg_refund_id -> Nullable<Varchar>, connector_refund_id -> Nullable<Varchar>,
external_reference_id -> Nullable<Varchar>, external_reference_id -> Nullable<Varchar>,
refund_type -> RefundType, refund_type -> RefundType,
total_amount -> Int8, total_amount -> Int8,

View File

@ -1,3 +1,3 @@
-- This file should undo anything in `up.sql` -- This file should undo anything in `up.sql`
ALTER TABLE payment_methods ALTER TABLE payment_methods
DROP COLUMN metadata JSON; DROP COLUMN metadata;

View File

@ -1,2 +1,2 @@
ALTER TABLE payment_id ALTER TABLE payment_attempt
RENAME attempt_id to txn_id; RENAME COLUMN attempt_id to txn_id;

View File

@ -0,0 +1,112 @@
ALTER TABLE address
ALTER COLUMN address_id TYPE VARCHAR(255),
ALTER COLUMN city TYPE VARCHAR(255),
ALTER COLUMN country TYPE VARCHAR(255),
ALTER COLUMN state TYPE VARCHAR(255),
ALTER COLUMN zip TYPE VARCHAR(255),
ALTER COLUMN phone_number TYPE VARCHAR(255),
ALTER COLUMN country_code TYPE VARCHAR(255),
ALTER COLUMN customer_id TYPE VARCHAR(255),
ALTER COLUMN merchant_id TYPE VARCHAR(255);
ALTER TABLE connector_response RENAME COLUMN attempt_id TO txn_id;
ALTER TABLE connector_response
ALTER COLUMN payment_id TYPE VARCHAR(255),
ALTER COLUMN merchant_id TYPE VARCHAR(255),
ALTER COLUMN txn_id TYPE VARCHAR(255),
ALTER COLUMN connector_name TYPE VARCHAR(32),
ALTER COLUMN connector_transaction_id TYPE VARCHAR(255);
ALTER TABLE customers
ALTER COLUMN customer_id TYPE VARCHAR(255),
ALTER COLUMN merchant_id TYPE VARCHAR(255),
ALTER COLUMN phone TYPE VARCHAR(255),
ALTER COLUMN phone_country_code TYPE VARCHAR(255);
ALTER TABLE events
ALTER COLUMN event_id TYPE VARCHAR(255),
ALTER COLUMN intent_reference_id TYPE VARCHAR(255),
ALTER COLUMN primary_object_id TYPE VARCHAR(255);
ALTER TABLE mandate RENAME COLUMN previous_attempt_id to previous_transaction_id;
ALTER TABLE mandate
ALTER COLUMN mandate_id TYPE VARCHAR(255),
ALTER COLUMN customer_id TYPE VARCHAR(255),
ALTER COLUMN merchant_id TYPE VARCHAR(255),
ALTER COLUMN payment_method_id TYPE VARCHAR(255),
ALTER COLUMN customer_ip_address TYPE VARCHAR(255),
ALTER COLUMN network_transaction_id TYPE VARCHAR(255),
ALTER COLUMN previous_transaction_id TYPE VARCHAR(255),
ALTER COLUMN connector TYPE VARCHAR(255),
ALTER COLUMN connector_mandate_id TYPE VARCHAR(255);
ALTER TABLE merchant_account
ALTER COLUMN merchant_id TYPE VARCHAR(255),
ALTER COLUMN api_key TYPE VARCHAR(255),
ALTER COLUMN merchant_name TYPE VARCHAR(255),
ALTER COLUMN parent_merchant_id TYPE VARCHAR(255),
ALTER COLUMN publishable_key TYPE VARCHAR(255);
ALTER TABLE merchant_connector_account
ALTER COLUMN merchant_id TYPE VARCHAR(255),
ALTER COLUMN connector_name TYPE VARCHAR(255);
ALTER TABLE payment_attempt
ALTER COLUMN payment_id TYPE VARCHAR(255),
ALTER COLUMN merchant_id TYPE VARCHAR(255),
ALTER COLUMN attempt_id TYPE VARCHAR(255),
ALTER COLUMN connector TYPE VARCHAR(255),
ALTER COLUMN payment_method_id TYPE VARCHAR(255),
ALTER COLUMN connector_transaction_id TYPE VARCHAR(255),
ALTER COLUMN mandate_id TYPE VARCHAR(255),
ALTER COLUMN payment_token TYPE VARCHAR(255);
ALTER TABLE payment_intent
ALTER COLUMN payment_id TYPE VARCHAR(255),
ALTER COLUMN merchant_id TYPE VARCHAR(255),
ALTER COLUMN customer_id TYPE VARCHAR(255),
ALTER COLUMN connector_id TYPE VARCHAR(255),
ALTER COLUMN shipping_address_id TYPE VARCHAR(255),
ALTER COLUMN billing_address_id TYPE VARCHAR(255),
ALTER COLUMN client_secret TYPE VARCHAR(255);
ALTER TABLE payment_methods ADD COLUMN network_transaction_id VARCHAR(255);
ALTER TABLE payment_methods
ALTER COLUMN customer_id TYPE VARCHAR(255),
ALTER COLUMN merchant_id TYPE VARCHAR(255),
ALTER COLUMN payment_method_id TYPE VARCHAR(255),
ALTER COLUMN scheme TYPE VARCHAR(255),
ALTER COLUMN token TYPE VARCHAR(255),
ALTER COLUMN issuer_name TYPE VARCHAR(255),
ALTER COLUMN issuer_country TYPE VARCHAR(255),
ALTER COLUMN swift_code TYPE VARCHAR(255),
ALTER COLUMN direct_debit_token TYPE VARCHAR(255),
ALTER COLUMN network_transaction_id TYPE VARCHAR(255),
ALTER COLUMN payment_method_issuer TYPE VARCHAR(255);
ALTER TABLE process_tracker
ALTER COLUMN name TYPE VARCHAR(255),
ALTER COLUMN runner TYPE VARCHAR(255);
ALTER TABLE refund RENAME COLUMN connector_transaction_id to transaction_id;
ALTER TABLE refund RENAME COLUMN connector_refund_id to pg_refund_id;
ALTER TABLE refund
ALTER COLUMN internal_reference_id TYPE VARCHAR(255),
ALTER COLUMN refund_id TYPE VARCHAR(255),
ALTER COLUMN payment_id TYPE VARCHAR(255),
ALTER COLUMN merchant_id TYPE VARCHAR(255),
ALTER COLUMN attempt_id TYPE VARCHAR(255),
ALTER COLUMN connector TYPE VARCHAR(255),
ALTER COLUMN pg_refund_id TYPE VARCHAR(255),
ALTER COLUMN external_reference_id TYPE VARCHAR(255),
ALTER COLUMN refund_arn TYPE VARCHAR(255);
ALTER TABLE reverse_lookup
ALTER COLUMN lookup_id TYPE VARCHAR(255),
ALTER COLUMN sk_id TYPE VARCHAR(50),
ALTER COLUMN pk_id TYPE VARCHAR(255),
ALTER COLUMN source TYPE VARCHAR(30);

View File

@ -0,0 +1,111 @@
ALTER TABLE address
ALTER COLUMN address_id TYPE VARCHAR(64),
ALTER COLUMN city TYPE VARCHAR(128),
ALTER COLUMN country TYPE VARCHAR(64),
ALTER COLUMN state TYPE VARCHAR(128),
ALTER COLUMN zip TYPE VARCHAR(16),
ALTER COLUMN phone_number TYPE VARCHAR(32),
ALTER COLUMN country_code TYPE VARCHAR(8),
ALTER COLUMN customer_id TYPE VARCHAR(64),
ALTER COLUMN merchant_id TYPE VARCHAR(64);
ALTER TABLE connector_response RENAME COLUMN txn_id TO attempt_id;
ALTER TABLE connector_response
ALTER COLUMN payment_id TYPE VARCHAR(64),
ALTER COLUMN merchant_id TYPE VARCHAR(64),
ALTER COLUMN attempt_id TYPE VARCHAR(64),
ALTER COLUMN connector_name TYPE VARCHAR(64),
ALTER COLUMN connector_transaction_id TYPE VARCHAR(128);
ALTER TABLE customers
ALTER COLUMN customer_id TYPE VARCHAR(64),
ALTER COLUMN merchant_id TYPE VARCHAR(64),
ALTER COLUMN phone TYPE VARCHAR(32),
ALTER COLUMN phone_country_code TYPE VARCHAR(8);
ALTER TABLE events
ALTER COLUMN event_id TYPE VARCHAR(64),
ALTER COLUMN intent_reference_id TYPE VARCHAR(64),
ALTER COLUMN primary_object_id TYPE VARCHAR(64);
ALTER TABLE mandate RENAME COLUMN previous_transaction_id to previous_attempt_id;
ALTER TABLE mandate
ALTER COLUMN mandate_id TYPE VARCHAR(64),
ALTER COLUMN customer_id TYPE VARCHAR(64),
ALTER COLUMN merchant_id TYPE VARCHAR(64),
ALTER COLUMN payment_method_id TYPE VARCHAR(64),
ALTER COLUMN customer_ip_address TYPE VARCHAR(64),
ALTER COLUMN network_transaction_id TYPE VARCHAR(128),
ALTER COLUMN previous_attempt_id TYPE VARCHAR(64),
ALTER COLUMN connector TYPE VARCHAR(64),
ALTER COLUMN connector_mandate_id TYPE VARCHAR(128);
ALTER TABLE merchant_account
ALTER COLUMN merchant_id TYPE VARCHAR(64),
ALTER COLUMN api_key TYPE VARCHAR(128),
ALTER COLUMN merchant_name TYPE VARCHAR(128),
ALTER COLUMN parent_merchant_id TYPE VARCHAR(64),
ALTER COLUMN publishable_key TYPE VARCHAR(128);
ALTER TABLE merchant_connector_account
ALTER COLUMN merchant_id TYPE VARCHAR(64),
ALTER COLUMN connector_name TYPE VARCHAR(64);
ALTER TABLE payment_attempt
ALTER COLUMN payment_id TYPE VARCHAR(64),
ALTER COLUMN merchant_id TYPE VARCHAR(64),
ALTER COLUMN attempt_id TYPE VARCHAR(64),
ALTER COLUMN connector TYPE VARCHAR(64),
ALTER COLUMN payment_method_id TYPE VARCHAR(64),
ALTER COLUMN connector_transaction_id TYPE VARCHAR(128),
ALTER COLUMN mandate_id TYPE VARCHAR(64),
ALTER COLUMN payment_token TYPE VARCHAR(128);
ALTER TABLE payment_intent
ALTER COLUMN payment_id TYPE VARCHAR(64),
ALTER COLUMN merchant_id TYPE VARCHAR(64),
ALTER COLUMN customer_id TYPE VARCHAR(64),
ALTER COLUMN connector_id TYPE VARCHAR(64),
ALTER COLUMN shipping_address_id TYPE VARCHAR(64),
ALTER COLUMN billing_address_id TYPE VARCHAR(64),
ALTER COLUMN client_secret TYPE VARCHAR(128);
ALTER TABLE payment_methods DROP COLUMN network_transaction_id;
ALTER TABLE payment_methods
ALTER COLUMN customer_id TYPE VARCHAR(64),
ALTER COLUMN merchant_id TYPE VARCHAR(64),
ALTER COLUMN payment_method_id TYPE VARCHAR(64),
ALTER COLUMN scheme TYPE VARCHAR(32),
ALTER COLUMN token TYPE VARCHAR(128),
ALTER COLUMN issuer_name TYPE VARCHAR(64),
ALTER COLUMN issuer_country TYPE VARCHAR(64),
ALTER COLUMN swift_code TYPE VARCHAR(32),
ALTER COLUMN direct_debit_token TYPE VARCHAR(128),
ALTER COLUMN payment_method_issuer TYPE VARCHAR(128);
ALTER TABLE process_tracker
ALTER COLUMN name TYPE VARCHAR(64),
ALTER COLUMN runner TYPE VARCHAR(64);
ALTER TABLE refund RENAME COLUMN transaction_id to connector_transaction_id;
ALTER TABLE refund RENAME COLUMN pg_refund_id to connector_refund_id;
ALTER TABLE refund
ALTER COLUMN internal_reference_id TYPE VARCHAR(64),
ALTER COLUMN refund_id TYPE VARCHAR(64),
ALTER COLUMN payment_id TYPE VARCHAR(64),
ALTER COLUMN merchant_id TYPE VARCHAR(64),
ALTER COLUMN connector_transaction_id TYPE VARCHAR(128),
ALTER COLUMN connector TYPE VARCHAR(64),
ALTER COLUMN connector_refund_id TYPE VARCHAR(128),
ALTER COLUMN external_reference_id TYPE VARCHAR(64),
ALTER COLUMN refund_arn TYPE VARCHAR(128);
ALTER TABLE reverse_lookup
ALTER COLUMN lookup_id TYPE VARCHAR(128),
ALTER COLUMN sk_id TYPE VARCHAR(128),
ALTER COLUMN pk_id TYPE VARCHAR(128),
ALTER COLUMN source TYPE VARCHAR(128);