Browse Source

Bugfix/add missing user id to unique key of account balance (#8179)

* Add missing userId to unique constraint of account balance

* Update changelog
pull/8156/merge
Thomas Kaul 1 day ago
committed by GitHub
parent
commit
5bb623c529
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 4
      apps/api/src/app/account-balance/account-balance.service.ts
  3. 5
      prisma/migrations/20261014000000_added_user_id_to_unique_constraint_of_account_balance/migration.sql
  4. 2
      prisma/schema.prisma

1
CHANGELOG.md

@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- Fixed an exception in the authentication interceptor when the time zone of the browser is not available - Fixed an exception in the authentication interceptor when the time zone of the browser is not available
- Fixed the missing `userId` in the unique constraint of the `AccountBalance` database schema
## 3.86.0 - 2026-10-13 ## 3.86.0 - 2026-10-13

4
apps/api/src/app/account-balance/account-balance.service.ts

@ -68,9 +68,9 @@ export class AccountBalanceService {
value: balance value: balance
}, },
where: { where: {
userId, accountId_userId_date: {
accountId_date: {
accountId, accountId,
userId,
date: resetHours(parseISO(date)) date: resetHours(parseISO(date))
} }
} }

5
prisma/migrations/20261014000000_added_user_id_to_unique_constraint_of_account_balance/migration.sql

@ -0,0 +1,5 @@
-- DropIndex
DROP INDEX "AccountBalance_accountId_date_key";
-- CreateIndex
CREATE UNIQUE INDEX "AccountBalance_accountId_userId_date_key" ON "AccountBalance"("accountId", "userId", "date");

2
prisma/schema.prisma

@ -65,7 +65,7 @@ model AccountBalance {
userId String userId String
value Float value Float
@@unique([accountId, date]) @@unique([accountId, userId, date])
@@index([accountId]) @@index([accountId])
@@index([date]) @@index([date])
} }

Loading…
Cancel
Save