fix: removed user_id, type unique for wallets

This commit is contained in:
Samuel Tariku 2025-10-15 21:11:41 +03:00
parent 459ebcc63b
commit 065e66e820
2 changed files with 2 additions and 7 deletions

View File

@ -91,9 +91,7 @@ VALUES (
TRUE, TRUE,
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP CURRENT_TIMESTAMP
) ON CONFLICT (user_id, type) DO )
UPDATE
SET updated_at = EXCLUDED.updated_at
RETURNING id INTO STRICT _company_wallet_id; RETURNING id INTO STRICT _company_wallet_id;
INSERT INTO companies ( INSERT INTO companies (
name, name,
@ -144,9 +142,7 @@ VALUES (
TRUE, TRUE,
CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP CURRENT_TIMESTAMP
) ON CONFLICT (user_id, type) DO )
UPDATE
SET updated_at = EXCLUDED.updated_at
RETURNING id INTO STRICT _branch_wallet_id; RETURNING id INTO STRICT _branch_wallet_id;
INSERT INTO branches ( INSERT INTO branches (
name, name,

View File

@ -73,7 +73,6 @@ CREATE TABLE IF NOT EXISTS wallets (
is_active BOOLEAN NOT NULL DEFAULT true, is_active BOOLEAN NOT NULL DEFAULT true,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE(user_id, type),
CONSTRAINT balance_positve CHECK (balance >= 0) CONSTRAINT balance_positve CHECK (balance >= 0)
); );
CREATE TABLE refresh_tokens ( CREATE TABLE refresh_tokens (