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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
refactor(blocklist): change primary key of blocklist table (#5356)
Prajjwal Kumar93047ae616b6
diff --git a/crates/diesel_models/src/schema.rs b/crates/diesel_models/src/schema.rsindex b27d1e9611..171e1cfe2e 100644--- a/crates/diesel_models/src/schema.rs+++ b/crates/diesel_models/src/schema.rs@@ -128,7 +128,7 @@ diesel::table! {use diesel::sql_types::*;use crate::enums::diesel_exports::*;- blocklist (id) {+ blocklist (merchant_id, fingerprint_id) {id -> Int4,#[max_length = 64]merchant_id -> Varchar,diff --git a/crates/diesel_models/src/schema_v2.rs b/crates/diesel_models/src/schema_v2.rsindex 3fdbf45025..d16ddcd651 100644--- a/crates/diesel_models/src/schema_v2.rs+++ b/crates/diesel_models/src/schema_v2.rs@@ -128,7 +128,7 @@ diesel::table! {use diesel::sql_types::*;use crate::enums::diesel_exports::*;- blocklist (id) {+ blocklist (merchant_id, fingerprint_id) {id -> Int4,#[max_length = 64]merchant_id -> Varchar,diff --git a/migrations/2024-07-17-174449_change_primary_key_for_blocklist_table/down.sql b/migrations/2024-07-17-174449_change_primary_key_for_blocklist_table/down.sqlnew file mode 100644index 0000000000..9600ce5add--- /dev/null+++ b/migrations/2024-07-17-174449_change_primary_key_for_blocklist_table/down.sql@@ -0,0 +1,5 @@+-- This file should undo anything in `up.sql`+ALTER TABLE blocklist DROP CONSTRAINT blocklist_pkey;++ALTER TABLE blocklist+ADD PRIMARY KEY (id);diff --git a/migrations/2024-07-17-174449_change_primary_key_for_blocklist_table/up.sql b/migrations/2024-07-17-174449_change_primary_key_for_blocklist_table/up.sqlnew file mode 100644index 0000000000..c0df6d6345--- /dev/null+++ b/migrations/2024-07-17-174449_change_primary_key_for_blocklist_table/up.sql@@ -0,0 +1,12 @@+-- Your SQL goes here+-- The below query will lock the blocklist table+-- Running this query is not necessary on higher environments+-- as the application will work fine without these queries being run+-- This query should be run after the new version of application is deployed+ALTER TABLE blocklist DROP CONSTRAINT blocklist_pkey;++-- Use the `merchant_id, fingerprint_id` columns as primary key+-- These are already unique, not null columns+-- So this query should not fail for not null or duplicate value reasons+ALTER TABLE blocklist+ADD PRIMARY KEY (merchant_id, fingerprint_id);