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

chore: add migrations for Currency type in DB (#6980)

Kashif60ed69c1cff7
diff --git a/migrations/2025-01-03-084904_add_currencies/down.sql b/migrations/2025-01-03-084904_add_currencies/down.sql
new file mode 100644
index 0000000000..e0ac49d1ec
--- /dev/null
+++ b/migrations/2025-01-03-084904_add_currencies/down.sql
@@ -0,0 +1 @@
+SELECT 1;
diff --git a/migrations/2025-01-03-084904_add_currencies/up.sql b/migrations/2025-01-03-084904_add_currencies/up.sql
new file mode 100644
index 0000000000..14167a32cf
--- /dev/null
+++ b/migrations/2025-01-03-084904_add_currencies/up.sql
@@ -0,0 +1,18 @@
+DO $$
+ DECLARE currency TEXT;
+ BEGIN
+ FOR currency IN
+ SELECT
+ unnest(
+ ARRAY ['AFN', 'BTN', 'CDF', 'ERN', 'IRR', 'ISK', 'KPW', 'SDG', 'SYP', 'TJS', 'TMT', 'ZWL']
+ ) AS currency
+ LOOP
+ IF NOT EXISTS (
+ SELECT 1
+ FROM pg_enum
+ WHERE enumlabel = currency
+ AND enumtypid = (SELECT oid FROM pg_type WHERE typname = 'Currency')
+ ) THEN EXECUTE format('ALTER TYPE "Currency" ADD VALUE %L', currency);
+ END IF;
+ END LOOP;
+END $$;
\ No newline at end of file