Wallet Provider
Ledger
Models
Balance

Balance

Stores User current balance token balance for a user

Schema

  • accountId : ID
  • tokenId : UUID
  • snapshotId : UUID
  • eventId : ID

Relations

Prisma definition

model Balance {
  accountId  String @map("account_id")
  tokenId    String @map("token_id") @db.Uuid
  snapshotId String @map("snapshot_id") @db.Uuid
  eventId    String @map("event_id")
 
  token          Token             @relation(fields: [tokenId], references: [id], onUpdate: NoAction, onDelete: NoAction)
  snapshot       BalanceSnapshot   @relation("balance_to_snapshot", fields: [snapshotId], references: [id], onUpdate: NoAction, onDelete: NoAction)
  dummy_snapshot BalanceSnapshot[] @relation("snapshot_to_balance")
  event          Event             @relation(fields: [eventId], references: [id], onUpdate: NoAction, onDelete: NoAction)
 
  @@id([accountId, tokenId])
  @@unique([snapshotId])
  @@map("balances")
}