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 000000000000..e0ac49d1ecfb --- /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 000000000000..14167a32cfcb --- /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