Main #41

Merged
aefril merged 16 commits from main into staging 2026-10-08 04:32:27 +02:00
4 changed files with 13 additions and 3 deletions
Showing only changes of commit c9654a387a - Show all commits
@@ -13,4 +13,4 @@ DROP INDEX IF EXISTS uq_payment_methods_point_per_organization;
ALTER TABLE payment_methods DROP CONSTRAINT IF EXISTS payment_methods_type_check; ALTER TABLE payment_methods DROP CONSTRAINT IF EXISTS payment_methods_type_check;
ALTER TABLE payment_methods ADD CONSTRAINT payment_methods_type_check ALTER TABLE payment_methods ADD CONSTRAINT payment_methods_type_check
CHECK (type IN ('cash', 'card', 'digital_wallet')); CHECK (type IN ('cash', 'card', 'digital_wallet', 'qr', 'edc', 'delivery'));
@@ -1,10 +1,11 @@
-- Paying with EnakPoint (docs/prd-point-coin.md F9, §8, §10.5). -- Paying with EnakPoint (docs/prd-point-coin.md F9, §8, §10.5).
-- A new payment method type. Every organization has exactly one method of it, made by -- A new payment method type, next to the existing ones (edc and delivery were added to
-- the constraint outside the migrations). Every organization has exactly one method of it, made by
-- the system, which cannot be deleted or change type. -- the system, which cannot be deleted or change type.
ALTER TABLE payment_methods DROP CONSTRAINT IF EXISTS payment_methods_type_check; ALTER TABLE payment_methods DROP CONSTRAINT IF EXISTS payment_methods_type_check;
ALTER TABLE payment_methods ADD CONSTRAINT payment_methods_type_check ALTER TABLE payment_methods ADD CONSTRAINT payment_methods_type_check
CHECK (type IN ('cash', 'card', 'digital_wallet', 'point')); CHECK (type IN ('cash', 'card', 'digital_wallet', 'qr', 'edc', 'delivery', 'point'));
CREATE UNIQUE INDEX uq_payment_methods_point_per_organization ON payment_methods(organization_id) CREATE UNIQUE INDEX uq_payment_methods_point_per_organization ON payment_methods(organization_id)
WHERE type = 'point'; WHERE type = 'point';
@@ -0,0 +1,2 @@
-- Nothing to undo: 000094 now allows the same types.
SELECT 1;
@@ -0,0 +1,7 @@
-- Production also has edc and delivery payment methods, allowed by a constraint changed
-- outside the migrations, and the code also accepts qr, which no constraint allowed.
-- 000094 first rewrote the constraint without them, which
-- failed on production and, where it ran, dropped them. Keep every type in use.
ALTER TABLE payment_methods DROP CONSTRAINT IF EXISTS payment_methods_type_check;
ALTER TABLE payment_methods ADD CONSTRAINT payment_methods_type_check
CHECK (type IN ('cash', 'card', 'digital_wallet', 'qr', 'edc', 'delivery', 'point'));