diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rs index 6e8bdb5ec26b..374197d1041b 100644 --- a/crates/diesel_models/src/schema.rs +++ b/crates/diesel_models/src/schema.rs @@ -251,7 +251,7 @@ diesel::table! { capture_sequence -> Int2, #[max_length = 128] connector_response_reference_id -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_capture_data -> Nullable, } } @@ -886,7 +886,7 @@ diesel::table! { card_network -> Nullable, shipping_cost -> Nullable, order_tax_amount -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_transaction_data -> Nullable, connector_mandate_detail -> Nullable, } @@ -1230,9 +1230,9 @@ diesel::table! { charges -> Nullable, #[max_length = 32] organization_id -> Varchar, - #[max_length = 512] + #[max_length = 1024] connector_refund_data -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_transaction_data -> Nullable, split_refunds -> Nullable, #[max_length = 255] diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rs index d38f684a44d2..c1a22f4cd58b 100644 --- a/crates/diesel_models/src/schema_v2.rs +++ b/crates/diesel_models/src/schema_v2.rs @@ -259,7 +259,7 @@ diesel::table! { capture_sequence -> Int2, #[max_length = 128] connector_response_reference_id -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_capture_data -> Nullable, } } @@ -852,7 +852,7 @@ diesel::table! { tax_on_surcharge -> Nullable, payment_method_billing_address -> Nullable, redirection_data -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_payment_data -> Nullable, #[max_length = 64] id -> Varchar, @@ -1176,9 +1176,9 @@ diesel::table! { charges -> Nullable, #[max_length = 32] organization_id -> Varchar, - #[max_length = 512] + #[max_length = 1024] connector_refund_data -> Nullable, - #[max_length = 512] + #[max_length = 1024] connector_transaction_data -> Nullable, split_refunds -> Nullable, #[max_length = 255] diff --git a/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql b/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql index a0068b16a36d..20f783dac794 100644 --- a/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql +++ b/migrations/2025-01-09-135057_increase_connector_transaction_data_length/up.sql @@ -1,4 +1,51 @@ -ALTER TABLE payment_attempt ALTER COLUMN connector_transaction_data TYPE VARCHAR(1024); -ALTER TABLE refund ALTER COLUMN connector_refund_data TYPE VARCHAR(1024); -ALTER TABLE refund ALTER COLUMN connector_transaction_data TYPE VARCHAR(1024); -ALTER TABLE captures ALTER COLUMN connector_capture_data TYPE VARCHAR(1024); \ No newline at end of file +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'payment_attempt' + AND column_name = 'connector_transaction_data' + ) THEN + ALTER TABLE payment_attempt + ALTER COLUMN connector_transaction_data TYPE VARCHAR(1024); + END IF; +END $$; + +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'refund' + AND column_name = 'connector_refund_data' + ) THEN + ALTER TABLE refund + ALTER COLUMN connector_refund_data TYPE VARCHAR(1024); + END IF; +END $$; + +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'refund' + AND column_name = 'connector_transaction_data' + ) THEN + ALTER TABLE refund + ALTER COLUMN connector_transaction_data TYPE VARCHAR(1024); + END IF; +END $$; + +DO $$ +BEGIN + IF EXISTS ( + SELECT 1 + FROM information_schema.columns + WHERE table_name = 'captures' + AND column_name = 'connector_capture_data' + ) THEN + ALTER TABLE captures + ALTER COLUMN connector_capture_data TYPE VARCHAR(1024); + END IF; +END $$; \ No newline at end of file diff --git a/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql b/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql index faebb36cdf9d..4609991ee56d 100644 --- a/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql +++ b/v2_migrations/2024-08-28-081721_add_v2_columns/up.sql @@ -51,7 +51,7 @@ ADD COLUMN payment_method_type_v2 VARCHAR, ADD COLUMN tax_on_surcharge BIGINT, ADD COLUMN payment_method_billing_address BYTEA, ADD COLUMN redirection_data JSONB, - ADD COLUMN connector_payment_data VARCHAR(512); + ADD COLUMN connector_payment_data VARCHAR(1024); -- Change the type of the column from JSON to JSONB ALTER TABLE merchant_connector_account diff --git a/v2_migrations/2024-10-08-081847_drop_v1_columns/down.sql b/v2_migrations/2024-10-08-081847_drop_v1_columns/down.sql index 64cbd2233eac..e06dc3666c64 100644 --- a/v2_migrations/2024-10-08-081847_drop_v1_columns/down.sql +++ b/v2_migrations/2024-10-08-081847_drop_v1_columns/down.sql @@ -76,7 +76,7 @@ ADD COLUMN IF NOT EXISTS attempt_id VARCHAR(64) NOT NULL, ADD COLUMN offer_amount bigint, ADD COLUMN payment_method VARCHAR, ADD COLUMN connector_transaction_id VARCHAR(64), - ADD COLUMN connector_transaction_data VARCHAR(512), + ADD COLUMN connector_transaction_data VARCHAR(1024), ADD COLUMN capture_method "CaptureMethod", ADD COLUMN capture_on TIMESTAMP, ADD COLUMN mandate_id VARCHAR(64),