Issue:
Bug: chore: resolve v2 warnings in diesel_models



Resolve v2 warnings in diesel_models.


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 resolves the v2 warnings generated in diesel_models.


### Additional Changes

- [ ] This PR modifies the API contract
- [ ] 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).
-->


## 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)?
-->




## 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`
- [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible


Testing:

Patch:
diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs
index 769a185c13c..be7f1b7ebeb 100644
--- a/crates/diesel_models/src/merchant_connector_account.rs
+++ b/crates/diesel_models/src/merchant_connector_account.rs
@@ -11,7 +11,7 @@ use crate::enums as storage_enums;
 #[cfg(feature = "v1")]
 use crate::schema::merchant_connector_account;
 #[cfg(feature = "v2")]
-use crate::{enums, schema_v2::merchant_connector_account, types};
+use crate::schema_v2::merchant_connector_account;
 
 #[cfg(feature = "v1")]
 #[derive(
diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rs
index 63f039c32f9..0ec57d9a911 100644
--- a/crates/diesel_models/src/payment_attempt.rs
+++ b/crates/diesel_models/src/payment_attempt.rs
@@ -966,7 +966,7 @@ impl PaymentAttemptUpdateInternal {
 
 #[cfg(feature = "v2")]
 impl PaymentAttemptUpdate {
-    pub fn apply_changeset(self, source: PaymentAttempt) -> PaymentAttempt {
+    pub fn apply_changeset(self, _source: PaymentAttempt) -> PaymentAttempt {
         todo!()
         // let PaymentAttemptUpdateInternal {
         //     net_amount,
@@ -1188,7 +1188,7 @@ impl PaymentAttemptUpdate {
 
 #[cfg(feature = "v2")]
 impl From<PaymentAttemptUpdate> for PaymentAttemptUpdateInternal {
-    fn from(payment_attempt_update: PaymentAttemptUpdate) -> Self {
+    fn from(_payment_attempt_update: PaymentAttemptUpdate) -> Self {
         todo!()
         // match payment_attempt_update {
         //     PaymentAttemptUpdate::Update {
diff --git a/crates/diesel_models/src/query/merchant_account.rs b/crates/diesel_models/src/query/merchant_account.rs
index ab51953b6ef..0b641217d4d 100644
--- a/crates/diesel_models/src/query/merchant_account.rs
+++ b/crates/diesel_models/src/query/merchant_account.rs
@@ -1,5 +1,8 @@
+#[cfg(feature = "v1")]
 use common_types::consts::API_VERSION;
-use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
+#[cfg(feature = "v1")]
+use diesel::BoolExpressionMethods;
+use diesel::{associations::HasTable, ExpressionMethods, Table};
 
 use super::generics;
 #[cfg(feature = "v1")]
diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs
index 2543ab41461..1226f44221a 100644
--- a/crates/diesel_models/src/query/payment_attempt.rs
+++ b/crates/diesel_models/src/query/payment_attempt.rs
@@ -1,9 +1,11 @@
+#[cfg(feature = "v1")]
 use std::collections::HashSet;
 
 use async_bb8_diesel::AsyncRunQueryDsl;
+#[cfg(feature = "v1")]
+use diesel::Table;
 use diesel::{
-    associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods,
-    QueryDsl, Table,
+    associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods, QueryDsl,
 };
 use error_stack::{report, ResultExt};
 
@@ -12,14 +14,14 @@ use super::generics;
 use crate::schema::payment_attempt::dsl;
 #[cfg(feature = "v2")]
 use crate::schema_v2::payment_attempt::dsl;
+#[cfg(feature = "v1")]
+use crate::{enums::IntentStatus, payment_attempt::PaymentAttemptUpdate, PaymentIntent};
 use crate::{
-    enums::{self, IntentStatus},
+    enums::{self},
     errors::DatabaseError,
-    payment_attempt::{
-        PaymentAttempt, PaymentAttemptNew, PaymentAttemptUpdate, PaymentAttemptUpdateInternal,
-    },
+    payment_attempt::{PaymentAttempt, PaymentAttemptNew, PaymentAttemptUpdateInternal},
     query::generics::db_metrics,
-    PaymentIntent, PgPooledConn, StorageResult,
+    PgPooledConn, StorageResult,
 };
 
 impl PaymentAttemptNew {
diff --git a/crates/diesel_models/src/query/payment_method.rs b/crates/diesel_models/src/query/payment_method.rs
index 62f6f37ba52..efb9198a28f 100644
--- a/crates/diesel_models/src/query/payment_method.rs
+++ b/crates/diesel_models/src/query/payment_method.rs
@@ -1,7 +1,11 @@
 use async_bb8_diesel::AsyncRunQueryDsl;
+#[cfg(all(
+    any(feature = "v1", feature = "v2"),
+    not(feature = "payment_methods_v2")
+))]
+use diesel::Table;
 use diesel::{
-    associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods,
-    QueryDsl, Table,
+    associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods, QueryDsl,
 };
 use error_stack::ResultExt;
 
diff --git a/crates/diesel_models/src/query/user/sample_data.rs b/crates/diesel_models/src/query/user/sample_data.rs
index 8ef4b1e9303..40cd264c052 100644
--- a/crates/diesel_models/src/query/user/sample_data.rs
+++ b/crates/diesel_models/src/query/user/sample_data.rs
@@ -14,9 +14,11 @@ use crate::schema_v2::{
     refund::dsl as refund_dsl,
 };
 use crate::{
-    errors, schema::dispute::dsl as dispute_dsl, user, Dispute, DisputeNew, PaymentAttempt,
-    PaymentIntent, PaymentIntentNew, PgPooledConn, Refund, RefundNew, StorageResult,
+    errors, schema::dispute::dsl as dispute_dsl, Dispute, DisputeNew, PaymentAttempt,
+    PaymentIntent, PgPooledConn, Refund, RefundNew, StorageResult,
 };
+#[cfg(feature = "v1")]
+use crate::{user, PaymentIntentNew};
 
 #[cfg(feature = "v1")]
 pub async fn insert_payment_intents(
diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rs
index 9212d416cb7..26c1834eb6d 100644
--- a/crates/diesel_models/src/user/sample_data.rs
+++ b/crates/diesel_models/src/user/sample_data.rs
@@ -1,20 +1,23 @@
+#[cfg(feature = "v1")]
 use common_enums::{
     AttemptStatus, AuthenticationType, CaptureMethod, Currency, PaymentExperience, PaymentMethod,
     PaymentMethodType,
 };
+#[cfg(feature = "v1")]
 use common_types::primitive_wrappers::{
     ExtendedAuthorizationAppliedBool, RequestExtendedAuthorizationBool,
 };
+#[cfg(feature = "v1")]
 use common_utils::types::{ConnectorTransactionId, MinorUnit};
+#[cfg(feature = "v1")]
 use serde::{Deserialize, Serialize};
+#[cfg(feature = "v1")]
 use time::PrimitiveDateTime;
 
 #[cfg(feature = "v1")]
-use crate::schema::payment_attempt;
-#[cfg(feature = "v2")]
-use crate::schema_v2::payment_attempt;
 use crate::{
     enums::{MandateDataType, MandateDetails},
+    schema::payment_attempt,
     ConnectorMandateReferenceId, PaymentAttemptNew,
 };