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
chore(payments): drop indexes made redundant by primary keys (#14691)
Hrithikesh99d8475d85af
diff --git a/migrations/2026-10-08-103000_drop_payment_attempt_attempt_id_merchant_id_index/down.sql b/migrations/2026-10-08-103000_drop_payment_attempt_attempt_id_merchant_id_index/down.sqlnew file mode 100644index 0000000000..5caf1f4a3d--- /dev/null+++ b/migrations/2026-10-08-103000_drop_payment_attempt_attempt_id_merchant_id_index/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+CREATE INDEX CONCURRENTLY IF NOT EXISTS payment_attempt_attempt_id_merchant_id_index ON payment_attempt (attempt_id, merchant_id);diff --git a/migrations/2026-10-08-103000_drop_payment_attempt_attempt_id_merchant_id_index/metadata.toml b/migrations/2026-10-08-103000_drop_payment_attempt_attempt_id_merchant_id_index/metadata.tomlnew file mode 100644index 0000000000..79e9221c1f--- /dev/null+++ b/migrations/2026-10-08-103000_drop_payment_attempt_attempt_id_merchant_id_index/metadata.toml@@ -0,0 +1 @@+run_in_transaction = falsediff --git a/migrations/2026-10-08-103000_drop_payment_attempt_attempt_id_merchant_id_index/up.sql b/migrations/2026-10-08-103000_drop_payment_attempt_attempt_id_merchant_id_index/up.sqlnew file mode 100644index 0000000000..aeb62fb0be--- /dev/null+++ b/migrations/2026-10-08-103000_drop_payment_attempt_attempt_id_merchant_id_index/up.sql@@ -0,0 +1,5 @@+-- Your SQL goes here+-- Exact duplicate of payment_attempt_pkey, which has been (attempt_id, merchant_id) since+-- the 2024-06-03-090859_make_id_as_optional_for_payments migration. This index was added as a+-- perf index in 2023-08-23 when the primary key was still (id), and became redundant after that.+DROP INDEX CONCURRENTLY IF EXISTS payment_attempt_attempt_id_merchant_id_index;diff --git a/migrations/2026-10-08-103001_drop_payment_attempt_payment_id_merchant_id_attempt_id_index/down.sql b/migrations/2026-10-08-103001_drop_payment_attempt_payment_id_merchant_id_attempt_id_index/down.sqlnew file mode 100644index 0000000000..de94b743e0--- /dev/null+++ b/migrations/2026-10-08-103001_drop_payment_attempt_payment_id_merchant_id_attempt_id_index/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS payment_attempt_payment_id_merchant_id_attempt_id_index ON payment_attempt (payment_id, merchant_id, attempt_id);diff --git a/migrations/2026-10-08-103001_drop_payment_attempt_payment_id_merchant_id_attempt_id_index/metadata.toml b/migrations/2026-10-08-103001_drop_payment_attempt_payment_id_merchant_id_attempt_id_index/metadata.tomlnew file mode 100644index 0000000000..79e9221c1f--- /dev/null+++ b/migrations/2026-10-08-103001_drop_payment_attempt_payment_id_merchant_id_attempt_id_index/metadata.toml@@ -0,0 +1 @@+run_in_transaction = falsediff --git a/migrations/2026-10-08-103001_drop_payment_attempt_payment_id_merchant_id_attempt_id_index/up.sql b/migrations/2026-10-08-103001_drop_payment_attempt_payment_id_merchant_id_attempt_id_index/up.sqlnew file mode 100644index 0000000000..ef9bd460d3--- /dev/null+++ b/migrations/2026-10-08-103001_drop_payment_attempt_payment_id_merchant_id_attempt_id_index/up.sql@@ -0,0 +1,7 @@+-- Your SQL goes here+-- Redundant with payment_attempt_pkey (attempt_id, merchant_id): because that key is already+-- unique, uniqueness over the (payment_id, merchant_id, attempt_id) superset is implied, and a+-- lookup on all three columns resolves to a single row through the primary key. Scans on the+-- leading (payment_id, merchant_id) prefix remain served by+-- payment_attempt_payment_id_merchant_id_index.+DROP INDEX CONCURRENTLY IF EXISTS payment_attempt_payment_id_merchant_id_attempt_id_index;diff --git a/migrations/2026-10-08-103002_drop_payment_intent_payment_id_merchant_id_index/down.sql b/migrations/2026-10-08-103002_drop_payment_intent_payment_id_merchant_id_index/down.sqlnew file mode 100644index 0000000000..db002f8e95--- /dev/null+++ b/migrations/2026-10-08-103002_drop_payment_intent_payment_id_merchant_id_index/down.sql@@ -0,0 +1,2 @@+-- This file should undo anything in `up.sql`+CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS payment_intent_payment_id_merchant_id_index ON payment_intent (payment_id, merchant_id);diff --git a/migrations/2026-10-08-103002_drop_payment_intent_payment_id_merchant_id_index/metadata.toml b/migrations/2026-10-08-103002_drop_payment_intent_payment_id_merchant_id_index/metadata.tomlnew file mode 100644index 0000000000..79e9221c1f--- /dev/null+++ b/migrations/2026-10-08-103002_drop_payment_intent_payment_id_merchant_id_index/metadata.toml@@ -0,0 +1 @@+run_in_transaction = falsediff --git a/migrations/2026-10-08-103002_drop_payment_intent_payment_id_merchant_id_index/up.sql b/migrations/2026-10-08-103002_drop_payment_intent_payment_id_merchant_id_index/up.sqlnew file mode 100644index 0000000000..5cc0bd6860--- /dev/null+++ b/migrations/2026-10-08-103002_drop_payment_intent_payment_id_merchant_id_index/up.sql@@ -0,0 +1,5 @@+-- Your SQL goes here+-- Exact duplicate of payment_intent_pkey, which has been (payment_id, merchant_id) since the+-- 2024-06-03-090859_make_id_as_optional_for_payments migration. Both are unique over the same+-- columns in the same order, so every lookup this index could serve is served by the primary key.+DROP INDEX CONCURRENTLY IF EXISTS payment_intent_payment_id_merchant_id_index;