mirror of
https://github.com/juspay/hyperswitch.git
synced 2026-03-13 09:02:06 +08:00
refactor(router): remove id dependency from merchant connector account, dispute and mandate (#5330)
Co-authored-by: hrithikesh026 <hrithikesh.vm@juspay.in> Co-authored-by: sai-harsha-vardhan <harsha111hero@gmail.com>
This commit is contained in:
@@ -25,7 +25,7 @@ impl MerchantConnectorAccount {
|
||||
) -> StorageResult<Self> {
|
||||
match generics::generic_update_by_id::<<Self as HasTable>::Table, _, _, _>(
|
||||
conn,
|
||||
self.id,
|
||||
self.merchant_connector_id.to_owned(),
|
||||
merchant_connector_account,
|
||||
)
|
||||
.await
|
||||
|
||||
@@ -336,7 +336,7 @@ diesel::table! {
|
||||
use diesel::sql_types::*;
|
||||
use crate::enums::diesel_exports::*;
|
||||
|
||||
dispute (id) {
|
||||
dispute (dispute_id) {
|
||||
id -> Int4,
|
||||
#[max_length = 64]
|
||||
dispute_id -> Varchar,
|
||||
@@ -587,7 +587,7 @@ diesel::table! {
|
||||
use diesel::sql_types::*;
|
||||
use crate::enums::diesel_exports::*;
|
||||
|
||||
mandate (id) {
|
||||
mandate (mandate_id) {
|
||||
id -> Int4,
|
||||
#[max_length = 64]
|
||||
mandate_id -> Varchar,
|
||||
@@ -677,7 +677,7 @@ diesel::table! {
|
||||
use diesel::sql_types::*;
|
||||
use crate::enums::diesel_exports::*;
|
||||
|
||||
merchant_connector_account (id) {
|
||||
merchant_connector_account (merchant_connector_id) {
|
||||
id -> Int4,
|
||||
#[max_length = 64]
|
||||
merchant_id -> Varchar,
|
||||
|
||||
@@ -336,7 +336,7 @@ diesel::table! {
|
||||
use diesel::sql_types::*;
|
||||
use crate::enums::diesel_exports::*;
|
||||
|
||||
dispute (id) {
|
||||
dispute (dispute_id) {
|
||||
id -> Int4,
|
||||
#[max_length = 64]
|
||||
dispute_id -> Varchar,
|
||||
@@ -587,7 +587,7 @@ diesel::table! {
|
||||
use diesel::sql_types::*;
|
||||
use crate::enums::diesel_exports::*;
|
||||
|
||||
mandate (id) {
|
||||
mandate (mandate_id) {
|
||||
id -> Int4,
|
||||
#[max_length = 64]
|
||||
mandate_id -> Varchar,
|
||||
@@ -677,7 +677,7 @@ diesel::table! {
|
||||
use diesel::sql_types::*;
|
||||
use crate::enums::diesel_exports::*;
|
||||
|
||||
merchant_connector_account (id) {
|
||||
merchant_connector_account (merchant_connector_id) {
|
||||
id -> Int4,
|
||||
#[max_length = 64]
|
||||
merchant_id -> Varchar,
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE dispute DROP CONSTRAINT dispute_pkey;
|
||||
|
||||
ALTER TABLE dispute ADD PRIMARY KEY (id);
|
||||
@@ -0,0 +1,11 @@
|
||||
-- Your SQL goes here
|
||||
-- The below query will lock the dispute table
|
||||
-- Running this query is not necessary on higher environments
|
||||
-- as the application will work fine without these queries being run
|
||||
-- This query is necessary for the application to not use id in update of dispute
|
||||
-- This query should be run only after the new version of application is deployed
|
||||
ALTER TABLE dispute DROP CONSTRAINT dispute_pkey;
|
||||
|
||||
-- Use the `dispute_id` column as primary key
|
||||
ALTER TABLE dispute
|
||||
ADD PRIMARY KEY (dispute_id);
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE mandate DROP CONSTRAINT mandate_pkey;
|
||||
|
||||
ALTER TABLE mandate ADD PRIMARY KEY (id);
|
||||
@@ -0,0 +1,11 @@
|
||||
-- Your SQL goes here
|
||||
-- The below query will lock the mandate table
|
||||
-- Running this query is not necessary on higher environments
|
||||
-- as the application will work fine without these queries being run
|
||||
-- This query is necessary for the application to not use id in update of mandate
|
||||
-- This query should be run only after the new version of application is deployed
|
||||
ALTER TABLE mandate DROP CONSTRAINT mandate_pkey;
|
||||
|
||||
-- Use the `mandate_id` column as primary key
|
||||
ALTER TABLE mandate
|
||||
ADD PRIMARY KEY (mandate_id);
|
||||
@@ -0,0 +1,5 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
ALTER TABLE merchant_connector_account DROP CONSTRAINT merchant_connector_account_pkey;
|
||||
|
||||
ALTER TABLE merchant_connector_account
|
||||
ADD PRIMARY KEY (id);
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Your SQL goes here
|
||||
-- The below query will lock the merchant connector account table
|
||||
-- Running this query is not necessary on higher environments
|
||||
-- as the application will work fine without these queries being run
|
||||
-- This query should be run only after the new version of application is deployed
|
||||
ALTER TABLE merchant_connector_account DROP CONSTRAINT merchant_connector_account_pkey;
|
||||
|
||||
-- Use the `merchant_connector_id` column as primary key
|
||||
-- This is not a unique column, but in an ideal scenario there should not be any duplicate keys as this is being generated by the application
|
||||
-- So this query should not fail for not null or duplicate values reasons
|
||||
ALTER TABLE merchant_connector_account
|
||||
ADD PRIMARY KEY (merchant_connector_id);
|
||||
Reference in New Issue
Block a user