drop unique constraint on payment accounts per country

closes #1842
This commit is contained in:
Changaco 2025-06-13 12:55:41 +02:00
parent 209600b217
commit a76f4f3588
No known key found for this signature in database
4 changed files with 4 additions and 19 deletions

View File

@ -4,7 +4,10 @@ BEGIN;
ADD COLUMN independent boolean DEFAULT true,
ADD COLUMN loss_taker loss_taker DEFAULT 'provider',
ADD COLUMN details_submitted boolean,
ADD COLUMN allow_payout boolean;
ADD COLUMN allow_payout boolean,
DROP CONSTRAINT payment_accounts_participant_provider_country_is_current_key;
CREATE INDEX payment_accounts_participant_provider_country_is_current_idx
ON payment_accounts (participant, provider, country, is_current);
END;
SELECT 'after deployment';
BEGIN;

View File

@ -61,12 +61,6 @@ if request.method == 'POST':
else:
loss_taker = 'platform'
serial_number = website.db.one("""
UPDATE payment_accounts
SET is_current = NULL
WHERE participant = %(p_id)s
AND provider = 'stripe'
AND country = %(country)s;
INSERT INTO payment_accounts
(participant, provider, country, id,
default_currency, charges_enabled, verified,

View File

@ -185,12 +185,6 @@ elif 'state' in request.qs:
account_data['token'] = json.dumps(account_data['token'])
with website.db.get_cursor() as cursor:
cursor.run("""
UPDATE payment_accounts
SET is_current = NULL
WHERE participant = %(p_id)s
AND provider = %(provider)s
AND country = %(country)s;
INSERT INTO payment_accounts
(participant, provider, country, id,
default_currency, charges_enabled, verified,

View File

@ -25,12 +25,6 @@ if request.method == 'POST':
)
with website.db.get_cursor() as cursor:
cursor.run("""
UPDATE payment_accounts
SET is_current = NULL
WHERE participant = %(p_id)s
AND provider = 'paypal'
AND country = %(country)s;
INSERT INTO payment_accounts
(participant, provider, country, id, verified,
independent, loss_taker)