Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix: add diesel migration to update local db (#1812)

Kritik Modi97a495cfa700
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs
index c70ad59cfd..76c0436a79 100644
--- a/crates/diesel_models/src/schema.rs
+++ b/crates/diesel_models/src/schema.rs
@@ -183,7 +183,7 @@ diesel::table! {
currency -> Varchar,
dispute_stage -> DisputeStage,
dispute_status -> DisputeStatus,
- #[max_length = 255]
+ #[max_length = 64]
payment_id -> Varchar,
#[max_length = 64]
attempt_id -> Varchar,
@@ -588,6 +588,7 @@ diesel::table! {
created_at -> Timestamp,
last_modified -> Timestamp,
payment_method -> Varchar,
+ #[max_length = 64]
payment_method_type -> Nullable<Varchar>,
#[max_length = 128]
payment_method_issuer -> Nullable<Varchar>,
diff --git a/migrations/2023-07-28-111829_update_columns_to_fix_db_diff/down.sql b/migrations/2023-07-28-111829_update_columns_to_fix_db_diff/down.sql
new file mode 100644
index 0000000000..681a0f5f06
--- /dev/null
+++ b/migrations/2023-07-28-111829_update_columns_to_fix_db_diff/down.sql
@@ -0,0 +1,8 @@
+ALTER TABLE dispute
+ALTER COLUMN payment_id TYPE VARCHAR(255);
+
+ALTER TABLE payment_methods
+ALTER COLUMN payment_method_type TYPE VARCHAR;
+
+ALTER TABLE merchant_account
+ALTER COLUMN primary_business_details SET DEFAULT '[{"country": "US", "business": "default"}]';
\ No newline at end of file
diff --git a/migrations/2023-07-28-111829_update_columns_to_fix_db_diff/up.sql b/migrations/2023-07-28-111829_update_columns_to_fix_db_diff/up.sql
new file mode 100644
index 0000000000..7ae0a22a9f
--- /dev/null
+++ b/migrations/2023-07-28-111829_update_columns_to_fix_db_diff/up.sql
@@ -0,0 +1,8 @@
+ALTER TABLE dispute
+ALTER COLUMN payment_id TYPE VARCHAR(64);
+
+ALTER TABLE payment_methods
+ALTER COLUMN payment_method_type TYPE VARCHAR(64);
+
+ALTER TABLE merchant_account
+ALTER COLUMN primary_business_details DROP DEFAULT;
\ No newline at end of file