mirror of https://github.com/ghostfolio/ghostfolio
				
				
			
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							357 lines
						
					
					
						
							9.0 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							357 lines
						
					
					
						
							9.0 KiB
						
					
					
				
								generator client {
							 | 
						|
								  provider        = "prisma-client-js"
							 | 
						|
								  previewFeatures = []
							 | 
						|
								  binaryTargets   = ["debian-openssl-3.0.x", "linux-arm64-openssl-3.0.x", "native"]
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								datasource db {
							 | 
						|
								  provider = "postgresql"
							 | 
						|
								  url      = env("DATABASE_URL")
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Access {
							 | 
						|
								  alias         String?
							 | 
						|
								  createdAt     DateTime           @default(now())
							 | 
						|
								  granteeUser   User?              @relation("accessGet", fields: [granteeUserId], onDelete: Cascade, references: [id])
							 | 
						|
								  granteeUserId String?
							 | 
						|
								  id            String             @id @default(uuid())
							 | 
						|
								  permissions   AccessPermission[] @default([READ_RESTRICTED])
							 | 
						|
								  updatedAt     DateTime           @updatedAt
							 | 
						|
								  userId        String
							 | 
						|
								  user          User               @relation("accessGive", fields: [userId], onDelete: Cascade, references: [id])
							 | 
						|
								
							 | 
						|
								  @@index([alias])
							 | 
						|
								  @@index([granteeUserId])
							 | 
						|
								  @@index([userId])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Account {
							 | 
						|
								  activities Order[]
							 | 
						|
								  balance    Float            @default(0)
							 | 
						|
								  balances   AccountBalance[]
							 | 
						|
								  comment    String?
							 | 
						|
								  createdAt  DateTime         @default(now())
							 | 
						|
								  currency   String?
							 | 
						|
								  id         String           @default(uuid())
							 | 
						|
								  isExcluded Boolean          @default(false)
							 | 
						|
								  name       String?
							 | 
						|
								  platform   Platform?        @relation(fields: [platformId], references: [id])
							 | 
						|
								  platformId String?
							 | 
						|
								  updatedAt  DateTime         @updatedAt
							 | 
						|
								  user       User             @relation(fields: [userId], onDelete: Cascade, references: [id])
							 | 
						|
								  userId     String
							 | 
						|
								
							 | 
						|
								  @@id([id, userId])
							 | 
						|
								  @@index([currency])
							 | 
						|
								  @@index([id])
							 | 
						|
								  @@index([isExcluded])
							 | 
						|
								  @@index([name])
							 | 
						|
								  @@index([userId])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model AccountBalance {
							 | 
						|
								  account   Account  @relation(fields: [accountId, userId], onDelete: Cascade, references: [id, userId])
							 | 
						|
								  accountId String
							 | 
						|
								  createdAt DateTime @default(now())
							 | 
						|
								  date      DateTime @default(now())
							 | 
						|
								  id        String   @id @default(uuid())
							 | 
						|
								  updatedAt DateTime @updatedAt
							 | 
						|
								  userId    String
							 | 
						|
								  value     Float
							 | 
						|
								
							 | 
						|
								  @@unique([accountId, date])
							 | 
						|
								  @@index([accountId])
							 | 
						|
								  @@index([date])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Analytics {
							 | 
						|
								  activityCount                       Int      @default(0)
							 | 
						|
								  country                             String?
							 | 
						|
								  dataProviderGhostfolioDailyRequests Int      @default(0)
							 | 
						|
								  lastRequestAt                       DateTime @default(now())
							 | 
						|
								  updatedAt                           DateTime @updatedAt
							 | 
						|
								  user                                User     @relation(fields: [userId], onDelete: Cascade, references: [id])
							 | 
						|
								  userId                              String   @id
							 | 
						|
								
							 | 
						|
								  @@index([lastRequestAt])
							 | 
						|
								  @@index([updatedAt])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model ApiKey {
							 | 
						|
								  createdAt DateTime @default(now())
							 | 
						|
								  hashedKey String   @unique
							 | 
						|
								  id        String   @id @default(uuid())
							 | 
						|
								  updatedAt DateTime @updatedAt
							 | 
						|
								  user      User     @relation(fields: [userId], onDelete: Cascade, references: [id])
							 | 
						|
								  userId    String
							 | 
						|
								
							 | 
						|
								  @@index([userId])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								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], onDelete: Cascade, references: [id])
							 | 
						|
								  userId              String
							 | 
						|
								
							 | 
						|
								  @@index([userId])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model DataProviderGhostfolioResolvedAssetProfile {
							 | 
						|
								  createdAt    DateTime   @default(now())
							 | 
						|
								  currency     String
							 | 
						|
								  dataSource   DataSource
							 | 
						|
								  id           String     @id @default(uuid())
							 | 
						|
								  requestCount Int        @default(1)
							 | 
						|
								  symbol       String
							 | 
						|
								  updatedAt    DateTime   @updatedAt
							 | 
						|
								
							 | 
						|
								  @@unique([dataSource, symbol])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model MarketData {
							 | 
						|
								  createdAt   DateTime        @default(now())
							 | 
						|
								  dataSource  DataSource
							 | 
						|
								  date        DateTime
							 | 
						|
								  id          String          @id @default(uuid())
							 | 
						|
								  marketPrice Float
							 | 
						|
								  state       MarketDataState @default(CLOSE)
							 | 
						|
								  symbol      String
							 | 
						|
								
							 | 
						|
								  @@unique([dataSource, date, symbol])
							 | 
						|
								  @@index([dataSource])
							 | 
						|
								  @@index([dataSource, symbol])
							 | 
						|
								  @@index([date])
							 | 
						|
								  @@index([marketPrice])
							 | 
						|
								  @@index([state])
							 | 
						|
								  @@index([symbol])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Order {
							 | 
						|
								  account         Account?      @relation(fields: [accountId, accountUserId], references: [id, userId])
							 | 
						|
								  accountId       String?
							 | 
						|
								  accountUserId   String?
							 | 
						|
								  comment         String?
							 | 
						|
								  createdAt       DateTime      @default(now())
							 | 
						|
								  currency        String?
							 | 
						|
								  date            DateTime
							 | 
						|
								  fee             Float
							 | 
						|
								  id              String        @id @default(uuid())
							 | 
						|
								  isDraft         Boolean       @default(false)
							 | 
						|
								  quantity        Float
							 | 
						|
								  symbolProfileId String
							 | 
						|
								  tags            Tag[]
							 | 
						|
								  type            Type
							 | 
						|
								  unitPrice       Float
							 | 
						|
								  updatedAt       DateTime      @updatedAt
							 | 
						|
								  user            User          @relation(fields: [userId], onDelete: Cascade, references: [id])
							 | 
						|
								  userId          String
							 | 
						|
								  SymbolProfile   SymbolProfile @relation(fields: [symbolProfileId], references: [id])
							 | 
						|
								
							 | 
						|
								  @@index([accountId])
							 | 
						|
								  @@index([date])
							 | 
						|
								  @@index([isDraft])
							 | 
						|
								  @@index([userId])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Platform {
							 | 
						|
								  accounts Account[]
							 | 
						|
								  id       String    @id @default(uuid())
							 | 
						|
								  name     String?
							 | 
						|
								  url      String    @unique
							 | 
						|
								
							 | 
						|
								  @@index([name])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Property {
							 | 
						|
								  key   String @id
							 | 
						|
								  value String
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Settings {
							 | 
						|
								  settings  Json?
							 | 
						|
								  updatedAt DateTime @updatedAt
							 | 
						|
								  user      User     @relation(fields: [userId], onDelete: Cascade, references: [id])
							 | 
						|
								  userId    String   @id
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model SymbolProfile {
							 | 
						|
								  activities             Order[]
							 | 
						|
								  assetClass             AssetClass?
							 | 
						|
								  assetSubClass          AssetSubClass?
							 | 
						|
								  comment                String?
							 | 
						|
								  countries              Json?
							 | 
						|
								  createdAt              DateTime                @default(now())
							 | 
						|
								  currency               String
							 | 
						|
								  cusip                  String?
							 | 
						|
								  dataSource             DataSource
							 | 
						|
								  figi                   String?
							 | 
						|
								  figiComposite          String?
							 | 
						|
								  figiShareClass         String?
							 | 
						|
								  holdings               Json?                   @default("[]")
							 | 
						|
								  id                     String                  @id @default(uuid())
							 | 
						|
								  isActive               Boolean                 @default(true)
							 | 
						|
								  isin                   String?
							 | 
						|
								  name                   String?
							 | 
						|
								  updatedAt              DateTime                @updatedAt
							 | 
						|
								  scraperConfiguration   Json?
							 | 
						|
								  sectors                Json?
							 | 
						|
								  symbol                 String
							 | 
						|
								  symbolMapping          Json?
							 | 
						|
								  url                    String?
							 | 
						|
								  user                   User?                   @relation(fields: [userId], onDelete: Cascade, references: [id])
							 | 
						|
								  userId                 String?
							 | 
						|
								  watchedBy              User[]                  @relation("UserWatchlist")
							 | 
						|
								  SymbolProfileOverrides SymbolProfileOverrides?
							 | 
						|
								
							 | 
						|
								  @@unique([dataSource, symbol])
							 | 
						|
								  @@index([assetClass])
							 | 
						|
								  @@index([currency])
							 | 
						|
								  @@index([cusip])
							 | 
						|
								  @@index([dataSource])
							 | 
						|
								  @@index([isActive])
							 | 
						|
								  @@index([isin])
							 | 
						|
								  @@index([name])
							 | 
						|
								  @@index([symbol])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model SymbolProfileOverrides {
							 | 
						|
								  assetClass      AssetClass?
							 | 
						|
								  assetSubClass   AssetSubClass?
							 | 
						|
								  countries       Json?          @default("[]")
							 | 
						|
								  holdings        Json?          @default("[]")
							 | 
						|
								  name            String?
							 | 
						|
								  sectors         Json?          @default("[]")
							 | 
						|
								  symbolProfileId String         @id
							 | 
						|
								  updatedAt       DateTime       @updatedAt
							 | 
						|
								  url             String?
							 | 
						|
								  SymbolProfile   SymbolProfile  @relation(fields: [symbolProfileId], onDelete: Cascade, references: [id])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Subscription {
							 | 
						|
								  createdAt DateTime @default(now())
							 | 
						|
								  expiresAt DateTime
							 | 
						|
								  id        String   @id @default(uuid())
							 | 
						|
								  price     Float?
							 | 
						|
								  updatedAt DateTime @updatedAt
							 | 
						|
								  user      User     @relation(fields: [userId], onDelete: Cascade, references: [id])
							 | 
						|
								  userId    String
							 | 
						|
								
							 | 
						|
								  @@index([userId])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Tag {
							 | 
						|
								  activities Order[]
							 | 
						|
								  id         String  @id @default(uuid())
							 | 
						|
								  name       String
							 | 
						|
								  user       User?   @relation(fields: [userId], onDelete: Cascade, references: [id])
							 | 
						|
								  userId     String?
							 | 
						|
								
							 | 
						|
								  @@unique([name, userId])
							 | 
						|
								  @@index([name])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model User {
							 | 
						|
								  accessesGet   Access[]        @relation("accessGet")
							 | 
						|
								  accessesGive  Access[]        @relation("accessGive")
							 | 
						|
								  accessToken   String?
							 | 
						|
								  accounts      Account[]
							 | 
						|
								  activities    Order[]
							 | 
						|
								  analytics     Analytics?
							 | 
						|
								  apiKeys       ApiKey[]
							 | 
						|
								  authChallenge String?
							 | 
						|
								  authDevices   AuthDevice[]
							 | 
						|
								  createdAt     DateTime        @default(now())
							 | 
						|
								  id            String          @id @default(uuid())
							 | 
						|
								  provider      Provider        @default(ANONYMOUS)
							 | 
						|
								  role          Role            @default(USER)
							 | 
						|
								  settings      Settings?
							 | 
						|
								  subscriptions Subscription[]
							 | 
						|
								  tags          Tag[]
							 | 
						|
								  thirdPartyId  String?
							 | 
						|
								  updatedAt     DateTime        @updatedAt
							 | 
						|
								  watchlist     SymbolProfile[] @relation("UserWatchlist")
							 | 
						|
								  SymbolProfile SymbolProfile[]
							 | 
						|
								
							 | 
						|
								  @@index([accessToken])
							 | 
						|
								  @@index([createdAt])
							 | 
						|
								  @@index([provider])
							 | 
						|
								  @@index([role])
							 | 
						|
								  @@index([thirdPartyId])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum AccessPermission {
							 | 
						|
								  READ
							 | 
						|
								  READ_RESTRICTED
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum AssetClass {
							 | 
						|
								  ALTERNATIVE_INVESTMENT
							 | 
						|
								  COMMODITY
							 | 
						|
								  EQUITY
							 | 
						|
								  FIXED_INCOME
							 | 
						|
								  LIQUIDITY
							 | 
						|
								  REAL_ESTATE
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum AssetSubClass {
							 | 
						|
								  BOND
							 | 
						|
								  CASH
							 | 
						|
								  COLLECTIBLE
							 | 
						|
								  COMMODITY
							 | 
						|
								  CRYPTOCURRENCY
							 | 
						|
								  ETF
							 | 
						|
								  MUTUALFUND
							 | 
						|
								  PRECIOUS_METAL
							 | 
						|
								  PRIVATE_EQUITY
							 | 
						|
								  STOCK
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum DataSource {
							 | 
						|
								  ALPHA_VANTAGE
							 | 
						|
								  COINGECKO
							 | 
						|
								  EOD_HISTORICAL_DATA
							 | 
						|
								  FINANCIAL_MODELING_PREP
							 | 
						|
								  GHOSTFOLIO
							 | 
						|
								  GOOGLE_SHEETS
							 | 
						|
								  MANUAL
							 | 
						|
								  RAPID_API
							 | 
						|
								  YAHOO
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum MarketDataState {
							 | 
						|
								  CLOSE
							 | 
						|
								  INTRADAY
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum Provider {
							 | 
						|
								  ANONYMOUS
							 | 
						|
								  GOOGLE
							 | 
						|
								  INTERNET_IDENTITY
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum Role {
							 | 
						|
								  ADMIN
							 | 
						|
								  DEMO
							 | 
						|
								  INACTIVE
							 | 
						|
								  USER
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum Type {
							 | 
						|
								  BUY
							 | 
						|
								  DIVIDEND
							 | 
						|
								  FEE
							 | 
						|
								  INTEREST
							 | 
						|
								  ITEM
							 | 
						|
								  LIABILITY
							 | 
						|
								  SELL
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum ViewMode {
							 | 
						|
								  DEFAULT
							 | 
						|
								  ZEN
							 | 
						|
								}
							 | 
						|
								
							 |