datasource db { provider = "postgresql" url = env("DATABASE_URL") } generator client { provider = "prisma-client-js" binaryTargets = ["debian-openssl-1.1.x", "native"] previewFeatures = [] } model Access { createdAt DateTime @default(now()) GranteeUser User? @relation(fields: [granteeUserId], name: "accessGet", references: [id]) granteeUserId String? id String @id @default(uuid()) updatedAt DateTime @updatedAt User User @relation(fields: [userId], name: "accessGive", references: [id]) userId String } model Account { accountType AccountType @default(SECURITIES) balance Float @default(0) createdAt DateTime @default(now()) currency String? id String @default(uuid()) isDefault Boolean @default(false) name String? Order Order[] Platform Platform? @relation(fields: [platformId], references: [id]) platformId String? updatedAt DateTime @updatedAt User User @relation(fields: [userId], references: [id]) userId String @@id([id, userId]) } model Analytics { activityCount Int @default(0) updatedAt DateTime @updatedAt User User @relation(fields: [userId], references: [id]) userId String @id } model AuthDevice { createdAt DateTime @default(now()) credentialId Bytes credentialPublicKey Bytes counter Int id String @id @default(uuid()) updatedAt DateTime @updatedAt User User @relation(fields: [userId], references: [id]) userId String } model MarketData { createdAt DateTime @default(now()) dataSource DataSource date DateTime id String @id @default(uuid()) symbol String marketPrice Float @@unique([date, symbol]) @@index(fields: [symbol]) } model Order { Account Account? @relation(fields: [accountId, accountUserId], references: [id, userId]) accountId String? accountUserId String? createdAt DateTime @default(now()) date DateTime fee Float id String @id @default(uuid()) isDraft Boolean @default(false) quantity Float SymbolProfile SymbolProfile @relation(fields: [symbolProfileId], references: [id]) symbolProfileId String tags Tag[] type Type unitPrice Float updatedAt DateTime @updatedAt User User @relation(fields: [userId], references: [id]) userId String } model Platform { Account Account[] id String @id @default(uuid()) name String? url String @unique } model Property { key String @id value String } model Settings { currency String? settings Json? updatedAt DateTime @updatedAt viewMode ViewMode? User User @relation(fields: [userId], references: [id]) userId String @id } model SymbolProfile { assetClass AssetClass? assetSubClass AssetSubClass? countries Json? createdAt DateTime @default(now()) currency String dataSource DataSource id String @id @default(uuid()) name String? Order Order[] updatedAt DateTime @updatedAt scraperConfiguration Json? sectors Json? symbol String symbolMapping Json? SymbolProfileOverrides SymbolProfileOverrides? url String? @@unique([dataSource, symbol]) } model SymbolProfileOverrides { assetClass AssetClass? assetSubClass AssetSubClass? countries Json? name String? sectors Json? SymbolProfile SymbolProfile @relation(fields: [symbolProfileId], references: [id]) symbolProfileId String @id updatedAt DateTime @updatedAt } model Subscription { createdAt DateTime @default(now()) expiresAt DateTime id String @id @default(uuid()) updatedAt DateTime @updatedAt User User @relation(fields: [userId], references: [id]) userId String } model Tag { id String @id @default(uuid()) name String @unique orders Order[] } model User { Access Access[] @relation("accessGet") AccessGive Access[] @relation(name: "accessGive") accessToken String? Account Account[] alias String? Analytics Analytics? authChallenge String? AuthDevice AuthDevice[] createdAt DateTime @default(now()) id String @id @default(uuid()) Order Order[] provider Provider @default(ANONYMOUS) role Role @default(USER) Settings Settings? Subscription Subscription[] thirdPartyId String? updatedAt DateTime @updatedAt } enum AccountType { CASH SECURITIES } enum AssetClass { CASH COMMODITY EQUITY FIXED_INCOME REAL_ESTATE } enum AssetSubClass { BOND COMMODITY CRYPTOCURRENCY ETF MUTUALFUND PRECIOUS_METAL PRIVATE_EQUITY STOCK } enum DataSource { ALPHA_VANTAGE EOD_HISTORICAL_DATA GHOSTFOLIO GOOGLE_SHEETS MANUAL RAKUTEN YAHOO } enum ViewMode { DEFAULT ZEN } enum Provider { ANONYMOUS GOOGLE } enum Role { ADMIN DEMO USER } enum Type { BUY DIVIDEND ITEM SELL }