Issue:
Bug: refactor: Patch file for DB migration



## Description
Create a patch file which removes id from schema.rs for all tables havin Integer id col.

Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->

- [ ] Bugfix
- [ ] New feature
- [ ] Enhancement
- [x] Refactoring
- [ ] Dependency updates
- [ ] Documentation
- [ ] CI/CD

## Description
<!-- Describe your changes in detail -->
This PR includes a patch file for removal of id from tables.

## Tables modified for API-V2:
**blocklist**
```
unique_key (merchant_id, fingerprint_id)
primary_key (merchant_id, fingerprint_id)
```

**payment_methods**
```
no unique_key 
primary_key (payment_method_id)
```

**refund**
```
unique_key (refund_id, merchant_id) 
primary_key (merchant_id, refund_id)
```

**user**
```
unique_key (user_id)
primary key (user_id)
```

**user_roles** 
```
unique_key (user_id, merchant_id)
primary_key (user_id, merchant_id)
```

**roles**
```
unique_key  (role_id)
primary_key (role_id)

```
### Additional Changes

- [ ] This PR modifies the API contract
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables

<!--
Provide links to the files with corresponding changes.

Following are the paths where you can find config files:
1. `config`
2. `crates/router/src/configs`
3. `loadtest/config`
-->


## Motivation and Context
<!--
Why is this change required? What problem does it solve?
If it fixes an open issue, please link to the issue here.

If you don't have an issue, we'd recommend starting with one first so the PR
can focus on the implementation (unless it is an obvious bug or documentation fix
that will have little conversation).
-->
required for v2

## How did you test it?
<!--
Did you write an integration/unit/API test to verify the code changes?
Or did you test this change manually (provide relevant screenshots)?
-->
The code compilation works fine, and moreover it is id exclusion so we can probably skip testing.

## Checklist
<!-- Put an `x` in the boxes that apply -->

- [x] I formatted the code `cargo +nightly fmt --all`
- [x] I addressed lints thrown by `cargo clippy`
- [x] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible


Testing:

The code compilation works fine, and moreover it is id exclusion so we can probably skip testing.

Patch:
diff --git a/crates/common_utils/src/id_type.rs b/crates/common_utils/src/id_type.rs
index 100f7957f5c..63f8497cae7 100644
--- a/crates/common_utils/src/id_type.rs
+++ b/crates/common_utils/src/id_type.rs
@@ -36,11 +36,11 @@ fn get_invalid_input_character(input_string: Cow<'static, str>) -> Option<char>
         .find(|char| !is_valid_id_character(char))
 }
 
-#[derive(Debug, PartialEq, Serialize, Clone, Eq, Hash)]
+#[derive(Debug, PartialEq, Hash, Serialize, Clone, Eq)]
 /// A type for alphanumeric ids
 pub(crate) struct AlphaNumericId(String);
 
-#[derive(Debug, Deserialize, Serialize, Error, Eq, PartialEq)]
+#[derive(Debug, Deserialize, Hash, Serialize, Error, Eq, PartialEq)]
 #[error("value `{0}` contains invalid character `{1}`")]
 /// The error type for alphanumeric id
 pub(crate) struct AlphaNumericIdError(String, char);
@@ -82,7 +82,7 @@ impl AlphaNumericId {
 }
 
 /// A common type of id that can be used for reference ids with length constraint
-#[derive(Debug, Clone, Serialize, PartialEq, Eq, AsExpression, Hash)]
+#[derive(Debug, Clone, Serialize, Hash, PartialEq, Eq, AsExpression)]
 #[diesel(sql_type = sql_types::Text)]
 pub(crate) struct LengthId<const MAX_LENGTH: u8, const MIN_LENGTH: u8>(AlphaNumericId);
 
diff --git a/crates/common_utils/src/id_type/customer.rs b/crates/common_utils/src/id_type/customer.rs
index f56957025b2..00bd565d9e0 100644
--- a/crates/common_utils/src/id_type/customer.rs
+++ b/crates/common_utils/src/id_type/customer.rs
@@ -17,7 +17,7 @@ use crate::{
 };
 
 /// A type for customer_id that can be used for customer ids
-#[derive(Clone, Serialize, Deserialize, PartialEq, Eq, AsExpression)]
+#[derive(Clone, Serialize, Deserialize, Hash, PartialEq, Eq, AsExpression)]
 #[diesel(sql_type = sql_types::Text)]
 pub struct CustomerId(
     LengthId<MAX_ALLOWED_MERCHANT_REFERENCE_ID_LENGTH, MIN_REQUIRED_MERCHANT_REFERENCE_ID_LENGTH>,
diff --git a/crates/diesel_models/remove_id.patch b/crates/diesel_models/remove_id.patch
new file mode 100644
index 00000000000..5b2e96ded3f
--- /dev/null
+++ b/crates/diesel_models/remove_id.patch
@@ -0,0 +1,108 @@
+diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
+index 55f8e935b..469ad1d22 100644
+--- a/crates/diesel_models/src/schema.rs
++++ b/crates/diesel_models/src/schema.rs
+@@ -5,7 +5,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     address (address_id) {
+-        id -> Nullable<Int4>,
+         #[max_length = 64]
+         address_id -> Varchar,
+         #[max_length = 128]
+@@ -129,7 +128,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     blocklist (merchant_id, fingerprint_id) {
+-        id -> Int4,
+         #[max_length = 64]
+         merchant_id -> Varchar,
+         #[max_length = 64]
+@@ -284,7 +282,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     customers (customer_id, merchant_id) {
+-        id -> Int4,
+         #[max_length = 64]
+         customer_id -> Varchar,
+         #[max_length = 64]
+@@ -337,7 +334,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     dispute (dispute_id) {
+-        id -> Int4,
+         #[max_length = 64]
+         dispute_id -> Varchar,
+         #[max_length = 255]
+@@ -588,7 +584,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     mandate (mandate_id) {
+-        id -> Int4,
+         #[max_length = 64]
+         mandate_id -> Varchar,
+         #[max_length = 64]
+@@ -634,7 +629,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     merchant_account (merchant_id) {
+-        id -> Int4,
+         #[max_length = 64]
+         merchant_id -> Varchar,
+         #[max_length = 255]
+@@ -678,7 +672,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     merchant_connector_account (merchant_connector_id) {
+-        id -> Int4,
+         #[max_length = 64]
+         merchant_id -> Varchar,
+         #[max_length = 64]
+@@ -741,7 +734,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     payment_attempt (attempt_id, merchant_id) {
+-        id -> Nullable<Int4>,
+         #[max_length = 64]
+         payment_id -> Varchar,
+         #[max_length = 64]
+@@ -832,7 +824,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     payment_intent (payment_id, merchant_id) {
+-        id -> Nullable<Int4>,
+         #[max_length = 64]
+         payment_id -> Varchar,
+         #[max_length = 64]
+@@ -935,7 +926,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     payment_methods (payment_method_id) {
+-        id -> Int4,
+         #[max_length = 64]
+         customer_id -> Varchar,
+         #[max_length = 64]
+@@ -1100,7 +1090,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     refund (merchant_id, refund_id) {
+-        id -> Int4,
+         #[max_length = 64]
+         internal_reference_id -> Varchar,
+         #[max_length = 64]
+@@ -1169,7 +1158,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     roles (role_id) {
+-        id -> Int4,
+         #[max_length = 64]
+         role_name -> Varchar,
+         #[max_length = 64]
+@@ -1276,7 +1263,6 @@ diesel::table! {
+     use crate::enums::diesel_exports::*;
+ 
+     users (user_id) {
+-        id -> Int4,
+         #[max_length = 64]
+         user_id -> Varchar,
+         #[max_length = 255]
diff --git a/crates/diesel_models/src/address.rs b/crates/diesel_models/src/address.rs
index 8de7d8aa190..aaaa7fb747a 100644
--- a/crates/diesel_models/src/address.rs
+++ b/crates/diesel_models/src/address.rs
@@ -39,7 +39,6 @@ pub struct AddressNew {
 #[derive(Clone, Debug, Queryable, Identifiable, Selectable, Serialize, Deserialize)]
 #[diesel(table_name = address, primary_key(address_id), check_for_backend(diesel::pg::Pg))]
 pub struct Address {
-    pub id: Option<i32>,
     pub address_id: String,
     pub city: Option<String>,
     pub country: Option<enums::CountryAlpha2>,
diff --git a/crates/diesel_models/src/blocklist.rs b/crates/diesel_models/src/blocklist.rs
index 0ef7daf0099..c4a5b48bad2 100644
--- a/crates/diesel_models/src/blocklist.rs
+++ b/crates/diesel_models/src/blocklist.rs
@@ -16,10 +16,8 @@ pub struct BlocklistNew {
 #[derive(
     Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Deserialize, Serialize,
 )]
-#[diesel(table_name = blocklist, check_for_backend(diesel::pg::Pg))]
+#[diesel(table_name = blocklist, primary_key(merchant_id, fingerprint_id), check_for_backend(diesel::pg::Pg))]
 pub struct Blocklist {
-    #[serde(skip)]
-    pub id: i32,
     pub merchant_id: common_utils::id_type::MerchantId,
     pub fingerprint_id: String,
     pub data_kind: common_enums::BlocklistDataKind,
diff --git a/crates/diesel_models/src/customers.rs b/crates/diesel_models/src/customers.rs
index ea552e0d399..7219bb90524 100644
--- a/crates/diesel_models/src/customers.rs
+++ b/crates/diesel_models/src/customers.rs
@@ -33,7 +33,6 @@ impl CustomerNew {
 impl From<CustomerNew> for Customer {
     fn from(customer_new: CustomerNew) -> Self {
         Self {
-            id: 0i32,
             customer_id: customer_new.customer_id,
             merchant_id: customer_new.merchant_id,
             name: customer_new.name,
@@ -55,9 +54,8 @@ impl From<CustomerNew> for Customer {
 #[derive(
     Clone, Debug, Identifiable, Queryable, Selectable, serde::Deserialize, serde::Serialize,
 )]
-#[diesel(table_name = customers, check_for_backend(diesel::pg::Pg))]
+#[diesel(table_name = customers, primary_key(customer_id, merchant_id), check_for_backend(diesel::pg::Pg))]
 pub struct Customer {
-    pub id: i32,
     pub customer_id: common_utils::id_type::CustomerId,
     pub merchant_id: common_utils::id_type::MerchantId,
     pub name: Option<Encryption>,
diff --git a/crates/diesel_models/src/dispute.rs b/crates/diesel_models/src/dispute.rs
index c2ef94e671f..704b1781e2a 100644
--- a/crates/diesel_models/src/dispute.rs
+++ b/crates/diesel_models/src/dispute.rs
@@ -33,10 +33,8 @@ pub struct DisputeNew {
 }
 
 #[derive(Clone, Debug, PartialEq, Serialize, Identifiable, Queryable, Selectable)]
-#[diesel(table_name = dispute, check_for_backend(diesel::pg::Pg))]
+#[diesel(table_name = dispute, primary_key(dispute_id), check_for_backend(diesel::pg::Pg))]
 pub struct Dispute {
-    #[serde(skip_serializing)]
-    pub id: i32,
     pub dispute_id: String,
     pub amount: String,
     pub currency: String,
diff --git a/crates/diesel_models/src/mandate.rs b/crates/diesel_models/src/mandate.rs
index ec4b572e8ee..bfac1849a58 100644
--- a/crates/diesel_models/src/mandate.rs
+++ b/crates/diesel_models/src/mandate.rs
@@ -9,9 +9,8 @@ use crate::{enums as storage_enums, schema::mandate};
 #[derive(
     Clone, Debug, Identifiable, Queryable, Selectable, serde::Serialize, serde::Deserialize,
 )]
-#[diesel(table_name = mandate, check_for_backend(diesel::pg::Pg))]
+#[diesel(table_name = mandate, primary_key(mandate_id), check_for_backend(diesel::pg::Pg))]
 pub struct Mandate {
-    pub id: i32,
     pub mandate_id: String,
     pub customer_id: common_utils::id_type::CustomerId,
     pub merchant_id: common_utils::id_type::MerchantId,
@@ -209,7 +208,6 @@ impl MandateUpdateInternal {
 impl From<&MandateNew> for Mandate {
     fn from(mandate_new: &MandateNew) -> Self {
         Self {
-            id: 0i32,
             mandate_id: mandate_new.mandate_id.clone(),
             customer_id: mandate_new.customer_id.clone(),
             merchant_id: mandate_new.merchant_id.clone(),
diff --git a/crates/diesel_models/src/merchant_account.rs b/crates/diesel_models/src/merchant_account.rs
index 4e99900af2f..23bc642c2db 100644
--- a/crates/diesel_models/src/merchant_account.rs
+++ b/crates/diesel_models/src/merchant_account.rs
@@ -26,7 +26,6 @@ use crate::schema_v2::merchant_account;
 )]
 #[diesel(table_name = merchant_account, primary_key(merchant_id), check_for_backend(diesel::pg::Pg))]
 pub struct MerchantAccount {
-    pub id: i32,
     pub merchant_id: id_type::MerchantId,
     pub return_url: Option<String>,
     pub enable_payment_response_hash: bool,
diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs
index 4b6ab77d8ae..eb561f2f9c6 100644
--- a/crates/diesel_models/src/merchant_connector_account.rs
+++ b/crates/diesel_models/src/merchant_connector_account.rs
@@ -16,9 +16,8 @@ use crate::{enums as storage_enums, schema::merchant_connector_account};
     Selectable,
     router_derive::DebugAsDisplay,
 )]
-#[diesel(table_name = merchant_connector_account, check_for_backend(diesel::pg::Pg))]
+#[diesel(table_name = merchant_connector_account, primary_key(merchant_connector_id), check_for_backend(diesel::pg::Pg))]
 pub struct MerchantConnectorAccount {
-    pub id: i32,
     pub merchant_id: id_type::MerchantId,
     pub connector_name: String,
     pub connector_account_details: Encryption,
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 791d4fb26e5..525c681a1e5 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -86,7 +86,6 @@ pub struct PaymentAttempt {
 )]
 #[diesel(table_name = payment_attempt, primary_key(attempt_id, merchant_id), check_for_backend(diesel::pg::Pg))]
 pub struct PaymentAttempt {
-    pub id: Option<i32>,
     pub payment_id: String,
     pub merchant_id: common_utils::id_type::MerchantId,
     pub attempt_id: String,
@@ -1703,7 +1702,6 @@ mod tests {
     #[test]
     fn test_backwards_compatibility() {
         let serialized_payment_attempt = r#"{
-    "id": 1,
     "payment_id": "PMT123456789",
     "merchant_id": "M123456789",
     "attempt_id": "ATMPT123456789",
diff --git a/crates/diesel_models/src/payment_intent.rs b/crates/diesel_models/src/payment_intent.rs
index 012376ae3d2..2d390b0b34c 100644
--- a/crates/diesel_models/src/payment_intent.rs
+++ b/crates/diesel_models/src/payment_intent.rs
@@ -74,7 +74,6 @@ pub struct PaymentIntent {
 #[derive(Clone, Debug, PartialEq, Identifiable, Queryable, Serialize, Deserialize, Selectable)]
 #[diesel(table_name = payment_intent, primary_key(payment_id, merchant_id), check_for_backend(diesel::pg::Pg))]
 pub struct PaymentIntent {
-    pub id: Option<i32>,
     pub payment_id: String,
     pub merchant_id: common_utils::id_type::MerchantId,
     pub status: storage_enums::IntentStatus,
@@ -1027,7 +1026,6 @@ mod tests {
     #[test]
     fn test_backwards_compatibility() {
         let serialized_payment_intent = r#"{
-    "id": 123,
     "payment_id": "payment_12345",
     "merchant_id": "merchant_67890",
     "status": "succeeded",
diff --git a/crates/diesel_models/src/payment_method.rs b/crates/diesel_models/src/payment_method.rs
index 0121ec5112c..b54824ad935 100644
--- a/crates/diesel_models/src/payment_method.rs
+++ b/crates/diesel_models/src/payment_method.rs
@@ -10,9 +10,8 @@ use crate::{enums as storage_enums, schema::payment_methods};
 #[derive(
     Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize,
 )]
-#[diesel(table_name = payment_methods, check_for_backend(diesel::pg::Pg))]
+#[diesel(table_name = payment_methods, primary_key(payment_method_id), check_for_backend(diesel::pg::Pg))]
 pub struct PaymentMethod {
-    pub id: i32,
     pub customer_id: common_utils::id_type::CustomerId,
     pub merchant_id: common_utils::id_type::MerchantId,
     pub payment_method_id: String,
@@ -329,7 +328,6 @@ impl From<PaymentMethodUpdate> for PaymentMethodUpdateInternal {
 impl From<&PaymentMethodNew> for PaymentMethod {
     fn from(payment_method_new: &PaymentMethodNew) -> Self {
         Self {
-            id: 0i32,
             customer_id: payment_method_new.customer_id.clone(),
             merchant_id: payment_method_new.merchant_id.clone(),
             payment_method_id: payment_method_new.payment_method_id.clone(),
diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rs
index b95ade2df1a..e4a74a6d66e 100644
--- a/crates/diesel_models/src/refund.rs
+++ b/crates/diesel_models/src/refund.rs
@@ -19,9 +19,8 @@ use crate::{enums as storage_enums, schema::refund};
     serde::Serialize,
     serde::Deserialize,
 )]
-#[diesel(table_name = refund, check_for_backend(diesel::pg::Pg))]
+#[diesel(table_name = refund, primary_key(refund_id), check_for_backend(diesel::pg::Pg))]
 pub struct Refund {
-    pub id: i32,
     pub internal_reference_id: String,
     pub refund_id: String, //merchant_reference id
     pub payment_id: String,
@@ -341,7 +340,6 @@ mod tests {
     #[test]
     fn test_backwards_compatibility() {
         let serialized_refund = r#"{
-    "id": 1,
     "internal_reference_id": "internal_ref_123",
     "refund_id": "refund_456",
     "payment_id": "payment_789",
diff --git a/crates/diesel_models/src/role.rs b/crates/diesel_models/src/role.rs
index cf38f49aadf..713590adeda 100644
--- a/crates/diesel_models/src/role.rs
+++ b/crates/diesel_models/src/role.rs
@@ -5,9 +5,8 @@ use time::PrimitiveDateTime;
 use crate::{enums, schema::roles};
 
 #[derive(Clone, Debug, Identifiable, Queryable, Selectable)]
-#[diesel(table_name = roles, check_for_backend(diesel::pg::Pg))]
+#[diesel(table_name = roles, primary_key(role_id), check_for_backend(diesel::pg::Pg))]
 pub struct Role {
-    pub id: i32,
     pub role_name: String,
     pub role_id: String,
     pub merchant_id: id_type::MerchantId,
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index 55f8e935b14..dd97469bc5e 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -5,7 +5,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     address (address_id) {
-        id -> Nullable<Int4>,
         #[max_length = 64]
         address_id -> Varchar,
         #[max_length = 128]
@@ -129,7 +128,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     blocklist (merchant_id, fingerprint_id) {
-        id -> Int4,
         #[max_length = 64]
         merchant_id -> Varchar,
         #[max_length = 64]
@@ -284,7 +282,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     customers (customer_id, merchant_id) {
-        id -> Int4,
         #[max_length = 64]
         customer_id -> Varchar,
         #[max_length = 64]
@@ -337,7 +334,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     dispute (dispute_id) {
-        id -> Int4,
         #[max_length = 64]
         dispute_id -> Varchar,
         #[max_length = 255]
@@ -588,7 +584,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     mandate (mandate_id) {
-        id -> Int4,
         #[max_length = 64]
         mandate_id -> Varchar,
         #[max_length = 64]
@@ -634,7 +629,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     merchant_account (merchant_id) {
-        id -> Int4,
         #[max_length = 64]
         merchant_id -> Varchar,
         #[max_length = 255]
@@ -678,7 +672,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     merchant_connector_account (merchant_connector_id) {
-        id -> Int4,
         #[max_length = 64]
         merchant_id -> Varchar,
         #[max_length = 64]
@@ -741,7 +734,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     payment_attempt (attempt_id, merchant_id) {
-        id -> Nullable<Int4>,
         #[max_length = 64]
         payment_id -> Varchar,
         #[max_length = 64]
@@ -832,7 +824,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     payment_intent (payment_id, merchant_id) {
-        id -> Nullable<Int4>,
         #[max_length = 64]
         payment_id -> Varchar,
         #[max_length = 64]
@@ -935,7 +926,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     payment_methods (payment_method_id) {
-        id -> Int4,
         #[max_length = 64]
         customer_id -> Varchar,
         #[max_length = 64]
@@ -1100,7 +1090,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     refund (merchant_id, refund_id) {
-        id -> Int4,
         #[max_length = 64]
         internal_reference_id -> Varchar,
         #[max_length = 64]
@@ -1169,7 +1158,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     roles (role_id) {
-        id -> Int4,
         #[max_length = 64]
         role_name -> Varchar,
         #[max_length = 64]
@@ -1276,7 +1264,6 @@ diesel::table! {
     use crate::enums::diesel_exports::*;
 
     users (user_id) {
-        id -> Int4,
         #[max_length = 64]
         user_id -> Varchar,
         #[max_length = 255]
diff --git a/crates/diesel_models/src/user.rs b/crates/diesel_models/src/user.rs
index 8469e4c2cab..582041ec42e 100644
--- a/crates/diesel_models/src/user.rs
+++ b/crates/diesel_models/src/user.rs
@@ -9,9 +9,8 @@ pub mod dashboard_metadata;
 
 pub mod sample_data;
 #[derive(Clone, Debug, Identifiable, Queryable, Selectable)]
-#[diesel(table_name = users, check_for_backend(diesel::pg::Pg))]
+#[diesel(table_name = users, primary_key(user_id), check_for_backend(diesel::pg::Pg))]
 pub struct User {
-    pub id: i32,
     pub user_id: String,
     pub email: pii::Email,
     pub name: Secret<String>,
diff --git a/crates/hyperswitch_domain_models/src/customer.rs b/crates/hyperswitch_domain_models/src/customer.rs
index 558a8b4469c..504c1c20465 100644
--- a/crates/hyperswitch_domain_models/src/customer.rs
+++ b/crates/hyperswitch_domain_models/src/customer.rs
@@ -22,7 +22,6 @@ pub enum SoftDeleteStatus {
 
 #[derive(Clone, Debug)]
 pub struct Customer {
-    pub id: Option<i32>,
     pub customer_id: id_type::CustomerId,
     pub merchant_id: id_type::MerchantId,
     pub name: crypto::OptionalEncryptableName,
@@ -49,9 +48,6 @@ impl super::behaviour::Conversion for Customer {
     type NewDstType = diesel_models::customers::CustomerNew;
     async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
         Ok(diesel_models::customers::Customer {
-            id: self.id.ok_or(ValidationError::MissingRequiredField {
-                field_name: "id".to_string(),
-            })?,
             customer_id: self.customer_id,
             merchant_id: self.merchant_id,
             name: self.name.map(|value| value.into()),
@@ -98,7 +94,6 @@ impl super::behaviour::Conversion for Customer {
             })?;
 
         Ok(Self {
-            id: Some(item.id),
             customer_id: item.customer_id,
             merchant_id: item.merchant_id,
             name: encryptable_customer.name,
diff --git a/crates/hyperswitch_domain_models/src/merchant_account.rs b/crates/hyperswitch_domain_models/src/merchant_account.rs
index eb5905c507e..6d311ea2d4d 100644
--- a/crates/hyperswitch_domain_models/src/merchant_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_account.rs
@@ -22,7 +22,6 @@ use crate::type_encryption::{decrypt_optional, AsyncLift};
 ))]
 #[derive(Clone, Debug, serde::Serialize)]
 pub struct MerchantAccount {
-    pub id: Option<i32>,
     merchant_id: common_utils::id_type::MerchantId,
     pub return_url: Option<String>,
     pub enable_payment_response_hash: bool,
@@ -95,7 +94,6 @@ pub struct MerchantAccountSetter {
 impl From<MerchantAccountSetter> for MerchantAccount {
     fn from(item: MerchantAccountSetter) -> Self {
         Self {
-            id: None,
             merchant_id: item.merchant_id,
             return_url: item.return_url,
             enable_payment_response_hash: item.enable_payment_response_hash,
@@ -416,9 +414,6 @@ impl super::behaviour::Conversion for MerchantAccount {
     type NewDstType = diesel_models::merchant_account::MerchantAccountNew;
     async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
         Ok(diesel_models::merchant_account::MerchantAccount {
-            id: self.id.ok_or(ValidationError::MissingRequiredField {
-                field_name: "id".to_string(),
-            })?,
             merchant_id: self.merchant_id,
             return_url: self.return_url,
             enable_payment_response_hash: self.enable_payment_response_hash,
@@ -465,7 +460,6 @@ impl super::behaviour::Conversion for MerchantAccount {
                 })?;
         async {
             Ok::<Self, error_stack::Report<common_utils::errors::CryptoError>>(Self {
-                id: Some(item.id),
                 merchant_id: item.merchant_id,
                 return_url: item.return_url,
                 enable_payment_response_hash: item.enable_payment_response_hash,
diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
index 7e4c5524727..9203a33239e 100644
--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs
@@ -682,7 +682,6 @@ impl behaviour::Conversion for PaymentIntent {
 
     async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
         Ok(DieselPaymentIntent {
-            id: None,
             payment_id: self.payment_id,
             merchant_id: self.merchant_id,
             status: self.status,
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index 33d24eeccea..42da0feb840 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -1439,7 +1439,6 @@ pub async fn create_payment_connector(
         business_sub_label: req.business_sub_label.clone(),
         created_at: date_time::now(),
         modified_at: date_time::now(),
-        id: None,
         connector_webhook_details: match req.connector_webhook_details {
             Some(connector_webhook_details) => {
                 connector_webhook_details.encode_to_value(
diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs
index 16f79e375b8..4c96f4fbe8f 100644
--- a/crates/router/src/core/customers.rs
+++ b/crates/router/src/core/customers.rs
@@ -170,7 +170,6 @@ impl CustomerCreateBridge for customers::CustomerRequest {
             description: self.description.clone(),
             phone_country_code: self.phone_country_code.clone(),
             metadata: self.metadata.clone(),
-            id: None,
             connector_customer: None,
             address_id: address_from_db.clone().map(|addr| addr.address_id),
             created_at: common_utils::date_time::now(),
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 6dd8f194724..f6bdd78fc25 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -362,7 +362,6 @@ pub async fn get_domain_address(
         let encryptable_address = AddressDetailsWithPhone::from_encryptable(encrypted_data)
             .change_context(common_utils::errors::CryptoError::EncodingFailed)?;
         Ok(domain::Address {
-            id: None,
             phone_number: encryptable_address.phone_number,
             country_code: address.phone.as_ref().and_then(|a| a.country_code.clone()),
             merchant_id: merchant_id.to_owned(),
@@ -1680,7 +1679,6 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R>(
                         phone_country_code: request_customer_details.phone_country_code.clone(),
                         description: None,
                         created_at: common_utils::date_time::now(),
-                        id: None,
                         metadata: None,
                         modified_at: common_utils::date_time::now(),
                         connector_customer: None,
diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs
index 41229552ad5..66ade4ee536 100644
--- a/crates/router/src/core/payouts/helpers.rs
+++ b/crates/router/src/core/payouts/helpers.rs
@@ -654,7 +654,6 @@ pub async fn get_or_create_customer_details(
                 phone_country_code: customer_details.phone_country_code.to_owned(),
                 metadata: None,
                 connector_customer: None,
-                id: None,
                 created_at: common_utils::date_time::now(),
                 modified_at: common_utils::date_time::now(),
                 address_id: None,
diff --git a/crates/router/src/db/address.rs b/crates/router/src/db/address.rs
index f15adbeea69..10ad8ebe80a 100644
--- a/crates/router/src/db/address.rs
+++ b/crates/router/src/db/address.rs
@@ -571,7 +571,6 @@ mod storage {
                     };
                     let field = format!("add_{}", &address_new.address_id);
                     let created_address = diesel_models::Address {
-                        id: Some(0i32),
                         address_id: address_new.address_id.clone(),
                         city: address_new.city.clone(),
                         country: address_new.country,
diff --git a/crates/router/src/db/dispute.rs b/crates/router/src/db/dispute.rs
index 4de14057c18..073b725448d 100644
--- a/crates/router/src/db/dispute.rs
+++ b/crates/router/src/db/dispute.rs
@@ -1,4 +1,4 @@
-use error_stack::{report, ResultExt};
+use error_stack::report;
 use router_env::{instrument, tracing};
 
 use super::{MockDb, Store};
@@ -148,8 +148,6 @@ impl DisputeInterface for MockDb {
         let now = common_utils::date_time::now();
 
         let new_dispute = storage::Dispute {
-            id: i32::try_from(locked_disputes.len())
-                .change_context(errors::StorageError::MockDbError)?,
             dispute_id: dispute.dispute_id,
             amount: dispute.amount,
             currency: dispute.currency,
@@ -674,7 +672,6 @@ mod tests {
                     .await
                     .unwrap();
 
-                assert_eq!(created_dispute.id, updated_dispute.id);
                 assert_eq!(created_dispute.dispute_id, updated_dispute.dispute_id);
                 assert_eq!(created_dispute.amount, updated_dispute.amount);
                 assert_eq!(created_dispute.currency, updated_dispute.currency);
@@ -751,7 +748,6 @@ mod tests {
                     .await
                     .unwrap();
 
-                assert_eq!(created_dispute.id, updated_dispute.id);
                 assert_eq!(created_dispute.dispute_id, updated_dispute.dispute_id);
                 assert_eq!(created_dispute.amount, updated_dispute.amount);
                 assert_eq!(created_dispute.currency, updated_dispute.currency);
@@ -827,7 +823,6 @@ mod tests {
                     .await
                     .unwrap();
 
-                assert_eq!(created_dispute.id, updated_dispute.id);
                 assert_eq!(created_dispute.dispute_id, updated_dispute.dispute_id);
                 assert_eq!(created_dispute.amount, updated_dispute.amount);
                 assert_eq!(created_dispute.currency, updated_dispute.currency);
diff --git a/crates/router/src/db/mandate.rs b/crates/router/src/db/mandate.rs
index bdc51c8ad8b..c85bb4cb176 100644
--- a/crates/router/src/db/mandate.rs
+++ b/crates/router/src/db/mandate.rs
@@ -1,5 +1,4 @@
 use common_utils::id_type;
-use error_stack::ResultExt;
 
 use super::MockDb;
 use crate::{
@@ -614,7 +613,6 @@ impl MandateInterface for MockDb {
     ) -> CustomResult<storage_types::Mandate, errors::StorageError> {
         let mut mandates = self.mandates.lock().await;
         let mandate = storage_types::Mandate {
-            id: i32::try_from(mandates.len()).change_context(errors::StorageError::MockDbError)?,
             mandate_id: mandate_new.mandate_id.clone(),
             customer_id: mandate_new.customer_id,
             merchant_id: mandate_new.merchant_id,
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index f48007d15b3..22f67b3538f 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -858,7 +858,6 @@ impl MerchantConnectorAccountInterface for MockDb {
     ) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {
         let mut accounts = self.merchant_connector_accounts.lock().await;
         let account = storage::MerchantConnectorAccount {
-            id: i32::try_from(accounts.len()).change_context(errors::StorageError::MockDbError)?,
             merchant_id: t.merchant_id,
             connector_name: t.connector_name,
             connector_account_details: t.connector_account_details.into(),
@@ -945,7 +944,7 @@ impl MerchantConnectorAccountInterface for MockDb {
             .lock()
             .await
             .iter_mut()
-            .find(|account| Some(account.id) == this.id)
+            .find(|account| account.merchant_connector_id == this.merchant_connector_id)
             .map(|a| {
                 let updated =
                     merchant_connector_account.create_merchant_connector_account(a.clone());
@@ -1097,7 +1096,6 @@ mod merchant_connector_account_cache_tests {
             .unwrap();
 
         let mca = domain::MerchantConnectorAccount {
-            id: Some(1),
             merchant_id: merchant_id.to_owned(),
             connector_name: "stripe".to_string(),
             connector_account_details: domain::types::encrypt(
diff --git a/crates/router/src/db/payment_method.rs b/crates/router/src/db/payment_method.rs
index b0fed03e9b5..e182d62c3f3 100644
--- a/crates/router/src/db/payment_method.rs
+++ b/crates/router/src/db/payment_method.rs
@@ -664,8 +664,6 @@ impl PaymentMethodInterface for MockDb {
         let mut payment_methods = self.payment_methods.lock().await;
 
         let payment_method = storage_types::PaymentMethod {
-            id: i32::try_from(payment_methods.len())
-                .change_context(errors::StorageError::MockDbError)?,
             customer_id: payment_method_new.customer_id,
             merchant_id: payment_method_new.merchant_id,
             payment_method_id: payment_method_new.payment_method_id,
@@ -784,7 +782,7 @@ impl PaymentMethodInterface for MockDb {
             .lock()
             .await
             .iter_mut()
-            .find(|pm| pm.id == payment_method.id)
+            .find(|pm| pm.payment_method_id == payment_method.payment_method_id)
             .map(|pm| {
                 let payment_method_updated =
                     PaymentMethodUpdateInternal::from(payment_method_update)
diff --git a/crates/router/src/db/refund.rs b/crates/router/src/db/refund.rs
index 67be1d30e04..1fa7e28cb81 100644
--- a/crates/router/src/db/refund.rs
+++ b/crates/router/src/db/refund.rs
@@ -4,7 +4,6 @@ use std::collections::HashSet;
 #[cfg(feature = "olap")]
 use common_utils::types::MinorUnit;
 use diesel_models::{errors::DatabaseError, refund::RefundUpdateInternal};
-use error_stack::ResultExt;
 
 use super::MockDb;
 use crate::{
@@ -372,7 +371,6 @@ mod storage {
                     // TODO: need to add an application generated payment attempt id to distinguish between multiple attempts for the same payment id
                     // Check for database presence as well Maybe use a read replica here ?
                     let created_refund = storage_types::Refund {
-                        id: 0i32,
                         refund_id: new.refund_id.clone(),
                         merchant_id: new.merchant_id.clone(),
                         attempt_id: new.attempt_id.clone(),
@@ -834,7 +832,6 @@ impl RefundInterface for MockDb {
         let current_time = common_utils::date_time::now();
 
         let refund = storage_types::Refund {
-            id: i32::try_from(refunds.len()).change_context(errors::StorageError::MockDbError)?,
             internal_reference_id: new.internal_reference_id,
             refund_id: new.refund_id,
             payment_id: new.payment_id,
diff --git a/crates/router/src/db/role.rs b/crates/router/src/db/role.rs
index 15dfc14d375..286a85190b8 100644
--- a/crates/router/src/db/role.rs
+++ b/crates/router/src/db/role.rs
@@ -1,7 +1,7 @@
 use common_enums::enums;
 use common_utils::id_type;
 use diesel_models::role as storage;
-use error_stack::{report, ResultExt};
+use error_stack::report;
 use router_env::{instrument, tracing};
 
 use super::MockDb;
@@ -138,7 +138,6 @@ impl RoleInterface for MockDb {
             })?
         }
         let role = storage::Role {
-            id: i32::try_from(roles.len()).change_context(errors::StorageError::MockDbError)?,
             role_name: role.role_name,
             role_id: role.role_id,
             merchant_id: role.merchant_id,
diff --git a/crates/router/src/db/user.rs b/crates/router/src/db/user.rs
index 742944bd1e0..b8c5001d910 100644
--- a/crates/router/src/db/user.rs
+++ b/crates/router/src/db/user.rs
@@ -1,5 +1,5 @@
 use diesel_models::user as storage;
-use error_stack::{report, ResultExt};
+use error_stack::report;
 use masking::Secret;
 use router_env::{instrument, tracing};
 
@@ -152,7 +152,6 @@ impl UserInterface for MockDb {
         }
         let time_now = common_utils::date_time::now();
         let user = storage::User {
-            id: i32::try_from(users.len()).change_context(errors::StorageError::MockDbError)?,
             user_id: user_data.user_id,
             email: user_data.email,
             name: user_data.name,
diff --git a/crates/router/src/types/domain/address.rs b/crates/router/src/types/domain/address.rs
index c7604622f3b..55d83679db9 100644
--- a/crates/router/src/types/domain/address.rs
+++ b/crates/router/src/types/domain/address.rs
@@ -17,8 +17,6 @@ use super::{behaviour, types};
 
 #[derive(Clone, Debug, serde::Serialize)]
 pub struct Address {
-    #[serde(skip_serializing)]
-    pub id: Option<i32>,
     pub address_id: String,
     pub city: Option<String>,
     pub country: Option<enums::CountryAlpha2>,
@@ -161,7 +159,6 @@ impl behaviour::Conversion for Address {
 
     async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
         Ok(diesel_models::address::Address {
-            id: self.id,
             address_id: self.address_id,
             city: self.city,
             country: self.country,
@@ -206,7 +203,6 @@ impl behaviour::Conversion for Address {
                 message: "Failed while decrypting".to_string(),
             })?;
         Ok(Self {
-            id: other.id,
             address_id: other.address_id,
             city: other.city,
             country: other.country,
diff --git a/crates/router/src/types/domain/merchant_connector_account.rs b/crates/router/src/types/domain/merchant_connector_account.rs
index 6b0436b6f2f..170113c7a2a 100644
--- a/crates/router/src/types/domain/merchant_connector_account.rs
+++ b/crates/router/src/types/domain/merchant_connector_account.rs
@@ -16,7 +16,6 @@ use super::{
 };
 #[derive(Clone, Debug)]
 pub struct MerchantConnectorAccount {
-    pub id: Option<i32>,
     pub merchant_id: common_utils::id_type::MerchantId,
     pub connector_name: String,
     pub connector_account_details: Encryptable<Secret<serde_json::Value>>,
@@ -74,9 +73,6 @@ impl behaviour::Conversion for MerchantConnectorAccount {
     async fn convert(self) -> CustomResult<Self::DstType, ValidationError> {
         Ok(
             diesel_models::merchant_connector_account::MerchantConnectorAccount {
-                id: self.id.ok_or(ValidationError::MissingRequiredField {
-                    field_name: "id".to_string(),
-                })?,
                 merchant_id: self.merchant_id,
                 connector_name: self.connector_name,
                 connector_account_details: self.connector_account_details.into(),
@@ -113,7 +109,6 @@ impl behaviour::Conversion for MerchantConnectorAccount {
     ) -> CustomResult<Self, ValidationError> {
         let identifier = Identifier::Merchant(other.merchant_id.clone());
         Ok(Self {
-            id: Some(other.id),
             merchant_id: other.merchant_id,
             connector_name: other.connector_name,
             connector_account_details: decrypt(
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index ea3a36b518a..c86f9240c4b 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -755,7 +755,6 @@ impl CustomerAddress for api_models::customers::CustomerRequest {
         let encryptable_address = AddressDetailsWithPhone::from_encryptable(encrypted_data)
             .change_context(common_utils::errors::CryptoError::EncodingFailed)?;
         let address = domain::Address {
-            id: None,
             city: address_details.city,
             country: address_details.country,
             line1: encryptable_address.line1,
diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs
index f5d28f7698d..03a9ac6e454 100644
--- a/crates/storage_impl/src/payments/payment_attempt.rs
+++ b/crates/storage_impl/src/payments/payment_attempt.rs
@@ -1292,7 +1292,6 @@ impl DataModelExt for PaymentAttempt {
 
     fn to_storage_model(self) -> Self::StorageModel {
         DieselPaymentAttempt {
-            id: None,
             payment_id: self.payment_id,
             merchant_id: self.merchant_id,
             attempt_id: self.attempt_id,
diff --git a/diesel.toml b/diesel.toml
index 0496c748c3e..9079080b31f 100644
--- a/diesel.toml
+++ b/diesel.toml
@@ -5,3 +5,4 @@
 file = "crates/diesel_models/src/schema.rs"
 import_types = ["diesel::sql_types::*", "crate::enums::diesel_exports::*"]
 generate_missing_sql_type_definitions = false
+patch_file="crates/diesel_models/remove_id.patch"