Issue:
Bug: [BUG] Remove default values for created_at and modified_at from the database



# Context
Currently we are setting `created_at` and `modified_at` in the database during insert through Posgresql `now()` function which gives the current time according to the current time zone. But when we modify the data we pass `common_utils::date_time::now` to update modified at which gives the date time in UTC.

# Resolution
Remove default values for `created_at` and `modified_at` from database and add it in `DatabaseStructNew` struct. Which forces the developer to pass these values while inserting, which fixes inconsistencies of these two values between database and application

Pull request description:
## Type of Change
<!-- Put an `x` in the boxes that apply -->
- [x] Bugfix

## Description
<!-- Describe your changes in detail -->
This closes #984 

### Additional Changes
- [x] This PR modifies the database schema

<!-- 
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 its an obvious bug or documentation fix
that will have little conversation).
-->
#984 

## 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)?
-->
Manual

## 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 submitted code

Testing:

Manual

Patch:
diff --git a/crates/router/src/types/domain/address.rs b/crates/router/src/types/domain/address.rs
index d69343cc798..8b88cf229cc 100644
--- a/crates/router/src/types/domain/address.rs
+++ b/crates/router/src/types/domain/address.rs
@@ -115,6 +115,7 @@ impl behaviour::Conversion for Address {
                 message: "id present while creating a new database entry".to_string(),
             })
         })?;
+        let now = date_time::now();
         Ok(Self::NewDstType {
             address_id: self.address_id,
             city: self.city,
@@ -130,6 +131,8 @@ impl behaviour::Conversion for Address {
             country_code: self.country_code,
             customer_id: self.customer_id,
             merchant_id: self.merchant_id,
+            created_at: now,
+            modified_at: now,
         })
     }
 }
diff --git a/crates/router/src/types/domain/customer.rs b/crates/router/src/types/domain/customer.rs
index c97e6e1a067..6472282e970 100644
--- a/crates/router/src/types/domain/customer.rs
+++ b/crates/router/src/types/domain/customer.rs
@@ -1,6 +1,6 @@
 use common_utils::{
     crypto::{self},
-    pii,
+    date_time, pii,
 };
 use error_stack::ResultExt;
 use storage_models::{customers::CustomerUpdateInternal, encryption::Encryption};
@@ -86,6 +86,7 @@ impl super::behaviour::Conversion for Customer {
     }
 
     async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {
+        let now = date_time::now();
         Ok(storage_models::customers::CustomerNew {
             customer_id: self.customer_id,
             merchant_id: self.merchant_id,
@@ -95,6 +96,8 @@ impl super::behaviour::Conversion for Customer {
             description: self.description,
             phone_country_code: self.phone_country_code,
             metadata: self.metadata,
+            created_at: now,
+            modified_at: now,
         })
     }
 }
@@ -128,7 +131,7 @@ impl From<CustomerUpdate> for CustomerUpdateInternal {
                 description,
                 phone_country_code,
                 metadata,
-                modified_at: Some(common_utils::date_time::now()),
+                modified_at: Some(date_time::now()),
             },
         }
     }
diff --git a/crates/router/src/types/domain/merchant_account.rs b/crates/router/src/types/domain/merchant_account.rs
index 04a57e7e818..218ea25ed3c 100644
--- a/crates/router/src/types/domain/merchant_account.rs
+++ b/crates/router/src/types/domain/merchant_account.rs
@@ -1,5 +1,6 @@
 use common_utils::{
     crypto::{Encryptable, GcmAes256, OptionalEncryptableName, OptionalEncryptableValue},
+    date_time,
     ext_traits::AsyncExt,
     pii,
 };
@@ -95,6 +96,7 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
                 locker_id,
                 metadata,
                 primary_business_details,
+                modified_at: Some(date_time::now()),
                 ..Default::default()
             },
             MerchantAccountUpdate::StorageSchemeUpdate { storage_scheme } => Self {
@@ -190,6 +192,7 @@ impl super::behaviour::Conversion for MerchantAccount {
     }
 
     async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {
+        let now = date_time::now();
         Ok(storage_models::merchant_account::MerchantAccountNew {
             merchant_id: self.merchant_id,
             merchant_name: self.merchant_name.map(Encryption::from),
@@ -207,6 +210,8 @@ impl super::behaviour::Conversion for MerchantAccount {
             routing_algorithm: self.routing_algorithm,
             api_key: self.api_key.map(Encryption::from),
             primary_business_details: self.primary_business_details,
+            created_at: now,
+            modified_at: now,
         })
     }
 }
diff --git a/crates/router/src/types/domain/merchant_connector_account.rs b/crates/router/src/types/domain/merchant_connector_account.rs
index 28e06e37a46..71fec8066a2 100644
--- a/crates/router/src/types/domain/merchant_connector_account.rs
+++ b/crates/router/src/types/domain/merchant_connector_account.rs
@@ -1,5 +1,6 @@
 use common_utils::{
     crypto::{Encryptable, GcmAes256},
+    date_time,
     errors::{CustomResult, ValidationError},
     pii,
 };
@@ -125,6 +126,7 @@ impl behaviour::Conversion for MerchantConnectorAccount {
     }
 
     async fn construct_new(self) -> CustomResult<Self::NewDstType, ValidationError> {
+        let now = date_time::now();
         Ok(Self::NewDstType {
             merchant_id: Some(self.merchant_id),
             connector_name: Some(self.connector_name),
@@ -140,6 +142,8 @@ impl behaviour::Conversion for MerchantConnectorAccount {
             business_label: self.business_label,
             connector_label: self.connector_label,
             business_sub_label: self.business_sub_label,
+            created_at: now,
+            modified_at: now,
         })
     }
 }
diff --git a/crates/router/src/types/domain/merchant_key_store.rs b/crates/router/src/types/domain/merchant_key_store.rs
index c4c0f4d830d..f92d6f43f55 100644
--- a/crates/router/src/types/domain/merchant_key_store.rs
+++ b/crates/router/src/types/domain/merchant_key_store.rs
@@ -1,6 +1,6 @@
 use common_utils::{
     crypto::{Encryptable, GcmAes256},
-    custom_serde,
+    custom_serde, date_time,
 };
 use error_stack::ResultExt;
 use masking::Secret;
@@ -56,6 +56,7 @@ impl super::behaviour::Conversion for MerchantKeyStore {
         Ok(storage_models::merchant_key_store::MerchantKeyStoreNew {
             merchant_id: self.merchant_id,
             key: self.key.into(),
+            created_at: date_time::now(),
         })
     }
 }
diff --git a/crates/storage_models/src/address.rs b/crates/storage_models/src/address.rs
index 7e775d66771..acbe8c561dd 100644
--- a/crates/storage_models/src/address.rs
+++ b/crates/storage_models/src/address.rs
@@ -1,4 +1,3 @@
-use common_utils::{consts, generate_id};
 use diesel::{AsChangeset, Identifiable, Insertable, Queryable};
 use time::PrimitiveDateTime;
 
@@ -22,6 +21,8 @@ pub struct AddressNew {
     pub country_code: Option<String>,
     pub customer_id: String,
     pub merchant_id: String,
+    pub created_at: PrimitiveDateTime,
+    pub modified_at: PrimitiveDateTime,
 }
 
 #[derive(Clone, Debug, Identifiable, Queryable, frunk::LabelledGeneric)]
@@ -68,24 +69,3 @@ pub struct AddressUpdateInternal {
     pub country_code: Option<String>,
     pub modified_at: PrimitiveDateTime,
 }
-
-impl Default for AddressNew {
-    fn default() -> Self {
-        Self {
-            address_id: generate_id(consts::ID_LENGTH, "add"),
-            city: None,
-            country: None,
-            line1: None,
-            line2: None,
-            line3: None,
-            state: None,
-            zip: None,
-            first_name: None,
-            last_name: None,
-            phone_number: None,
-            country_code: None,
-            customer_id: String::default(),
-            merchant_id: String::default(),
-        }
-    }
-}
diff --git a/crates/storage_models/src/customers.rs b/crates/storage_models/src/customers.rs
index 0bfe4f77b50..103c2e02085 100644
--- a/crates/storage_models/src/customers.rs
+++ b/crates/storage_models/src/customers.rs
@@ -4,7 +4,7 @@ use time::PrimitiveDateTime;
 
 use crate::{encryption::Encryption, schema::customers};
 
-#[derive(Default, Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
+#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
 #[diesel(table_name = customers)]
 pub struct CustomerNew {
     pub customer_id: String,
@@ -15,6 +15,8 @@ pub struct CustomerNew {
     pub description: Option<String>,
     pub phone_country_code: Option<String>,
     pub metadata: Option<pii::SecretSerdeValue>,
+    pub created_at: PrimitiveDateTime,
+    pub modified_at: PrimitiveDateTime,
 }
 
 #[derive(Clone, Debug, Identifiable, Queryable)]
diff --git a/crates/storage_models/src/merchant_account.rs b/crates/storage_models/src/merchant_account.rs
index 2266206f615..769e0fa5299 100644
--- a/crates/storage_models/src/merchant_account.rs
+++ b/crates/storage_models/src/merchant_account.rs
@@ -36,7 +36,7 @@ pub struct MerchantAccount {
     pub modified_at: time::PrimitiveDateTime,
 }
 
-#[derive(Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay)]
+#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
 #[diesel(table_name = merchant_account)]
 pub struct MerchantAccountNew {
     pub merchant_id: String,
@@ -55,6 +55,8 @@ pub struct MerchantAccountNew {
     pub routing_algorithm: Option<serde_json::Value>,
     pub api_key: Option<Encryption>,
     pub primary_business_details: serde_json::Value,
+    pub created_at: time::PrimitiveDateTime,
+    pub modified_at: time::PrimitiveDateTime,
 }
 
 #[derive(Debug)]
diff --git a/crates/storage_models/src/merchant_connector_account.rs b/crates/storage_models/src/merchant_connector_account.rs
index c9f6ea3d01c..7df614acecb 100644
--- a/crates/storage_models/src/merchant_connector_account.rs
+++ b/crates/storage_models/src/merchant_connector_account.rs
@@ -34,7 +34,7 @@ pub struct MerchantConnectorAccount {
     pub modified_at: time::PrimitiveDateTime,
 }
 
-#[derive(Clone, Debug, Default, Insertable, router_derive::DebugAsDisplay)]
+#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
 #[diesel(table_name = merchant_connector_account)]
 pub struct MerchantConnectorAccountNew {
     pub merchant_id: Option<String>,
@@ -51,6 +51,8 @@ pub struct MerchantConnectorAccountNew {
     pub business_country: storage_enums::CountryCode,
     pub business_label: String,
     pub business_sub_label: Option<String>,
+    pub created_at: time::PrimitiveDateTime,
+    pub modified_at: time::PrimitiveDateTime,
 }
 
 #[derive(Clone, Debug, Default, AsChangeset, router_derive::DebugAsDisplay)]
diff --git a/crates/storage_models/src/merchant_key_store.rs b/crates/storage_models/src/merchant_key_store.rs
index 90d24f5b932..5ac7c32675c 100644
--- a/crates/storage_models/src/merchant_key_store.rs
+++ b/crates/storage_models/src/merchant_key_store.rs
@@ -29,6 +29,7 @@ pub struct MerchantKeyStore {
 pub struct MerchantKeyStoreNew {
     pub merchant_id: String,
     pub key: Encryption,
+    pub created_at: PrimitiveDateTime,
 }
 
 #[derive(
diff --git a/migrations/2023-04-26-090005_remove_default_created_at_modified_at/down.sql b/migrations/2023-04-26-090005_remove_default_created_at_modified_at/down.sql
new file mode 100644
index 00000000000..dca5ed89b8e
--- /dev/null
+++ b/migrations/2023-04-26-090005_remove_default_created_at_modified_at/down.sql
@@ -0,0 +1,64 @@
+-- Merchant Account
+ALTER TABLE merchant_account
+ALTER COLUMN modified_at SET DEFAULT now();
+
+ALTER TABLE merchant_account
+ALTER COLUMN created_at SET DEFAULT now();
+
+
+-- Merchant Connector Account
+ALTER TABLE merchant_connector_account
+ALTER COLUMN modified_at SET DEFAULT now();
+
+ALTER TABLE merchant_connector_account
+ALTER COLUMN created_at SET DEFAULT now();
+
+-- Customers
+ALTER TABLE customers
+ALTER COLUMN modified_at SET DEFAULT now();
+
+ALTER TABLE customers
+ALTER COLUMN created_at SET DEFAULT now();
+
+-- Address
+ALTER TABLE address
+ALTER COLUMN modified_at SET DEFAULT now();
+
+ALTER TABLE address
+ALTER COLUMN created_at SET DEFAULT now();
+
+-- Refunds
+ALTER TABLE refund
+ALTER COLUMN modified_at SET DEFAULT now();
+
+ALTER TABLE refund
+ALTER COLUMN created_at SET DEFAULT now();
+
+-- Connector Response
+ALTER TABLE connector_response
+ALTER COLUMN modified_at SET DEFAULT now();
+
+ALTER TABLE connector_response
+ALTER COLUMN created_at SET DEFAULT now();
+
+-- Payment methods
+ALTER TABLE payment_methods
+ALTER COLUMN created_at SET DEFAULT now();
+
+-- MerchantKeystore
+ALTER TABLE merchantkeystore
+ALTER COLUMN created_at SET DEFAULT now();
+
+-- Payment Intent
+ALTER TABLE payment_intent
+ALTER COLUMN modified_at SET DEFAULT now();
+
+ALTER TABLE payment_intent
+ALTER COLUMN created_at SET DEFAULT now();
+
+--- Payment Attempt
+ALTER TABLE payment_attempt
+ALTER COLUMN modified_at SET DEFAULT now();
+
+ALTER TABLE payment_attempt
+ALTER COLUMN created_at SET DEFAULT now();
diff --git a/migrations/2023-04-26-090005_remove_default_created_at_modified_at/up.sql b/migrations/2023-04-26-090005_remove_default_created_at_modified_at/up.sql
new file mode 100644
index 00000000000..bb959aa3537
--- /dev/null
+++ b/migrations/2023-04-26-090005_remove_default_created_at_modified_at/up.sql
@@ -0,0 +1,64 @@
+-- Merchant Account
+ALTER TABLE merchant_account
+ALTER COLUMN modified_at DROP DEFAULT;
+
+ALTER TABLE merchant_account
+ALTER COLUMN created_at DROP DEFAULT;
+
+
+-- Merchant Connector Account
+ALTER TABLE merchant_connector_account
+ALTER COLUMN modified_at DROP DEFAULT;
+
+ALTER TABLE merchant_connector_account
+ALTER COLUMN created_at DROP DEFAULT;
+
+-- Customers
+ALTER TABLE customers
+ALTER COLUMN modified_at DROP DEFAULT;
+
+ALTER TABLE customers
+ALTER COLUMN created_at DROP DEFAULT;
+
+-- Address
+ALTER TABLE address
+ALTER COLUMN modified_at DROP DEFAULT;
+
+ALTER TABLE address
+ALTER COLUMN created_at DROP DEFAULT;
+
+-- Refunds
+ALTER TABLE refund
+ALTER COLUMN modified_at DROP DEFAULT;
+
+ALTER TABLE refund
+ALTER COLUMN created_at DROP DEFAULT;
+
+-- Connector Response
+ALTER TABLE connector_response
+ALTER COLUMN modified_at DROP DEFAULT;
+
+ALTER TABLE connector_response
+ALTER COLUMN created_at DROP DEFAULT;
+
+-- Payment methods
+ALTER TABLE payment_methods
+ALTER COLUMN created_at DROP DEFAULT;
+
+-- MerchantKeystore
+ALTER TABLE merchantkeystore
+ALTER COLUMN created_at DROP DEFAULT;
+
+-- Payment Intent
+ALTER TABLE payment_intent
+ALTER COLUMN modified_at DROP DEFAULT;
+
+ALTER TABLE payment_intent
+ALTER COLUMN created_at DROP DEFAULT;
+
+--- Payment Attempt
+ALTER TABLE payment_attempt
+ALTER COLUMN modified_at DROP DEFAULT;
+
+ALTER TABLE payment_attempt
+ALTER COLUMN created_at DROP DEFAULT;