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.
		
		
		
		
		
			
		
			
				
					
					
						
							150 lines
						
					
					
						
							3.3 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							150 lines
						
					
					
						
							3.3 KiB
						
					
					
				
								// This is your Prisma schema file,
							 | 
						|
								// learn more about it in the docs: https://pris.ly/d/prisma-schema
							 | 
						|
								
							 | 
						|
								datasource db {
							 | 
						|
								  provider = "postgresql"
							 | 
						|
								  url      = env("DATABASE_URL")
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								generator client {
							 | 
						|
								  provider        = "prisma-client-js"
							 | 
						|
								  binaryTargets   = ["debian-openssl-1.1.x", "native"]
							 | 
						|
								  previewFeatures = ["orderByRelation", "selectRelationCount"]
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Access {
							 | 
						|
								  createdAt     DateTime @default(now())
							 | 
						|
								  GranteeUser   User     @relation(fields: [granteeUserId], name: "accessGet", references: [id])
							 | 
						|
								  granteeUserId String
							 | 
						|
								  id            String   @default(uuid())
							 | 
						|
								  updatedAt     DateTime @updatedAt
							 | 
						|
								  User          User     @relation(fields: [userId], name: "accessGive", references: [id])
							 | 
						|
								  userId        String
							 | 
						|
								
							 | 
						|
								  @@id([id, userId])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Account {
							 | 
						|
								  accountType AccountType @default(SECURITIES)
							 | 
						|
								  createdAt   DateTime    @default(now())
							 | 
						|
								  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 MarketData {
							 | 
						|
								  createdAt   DateTime @default(now())
							 | 
						|
								  date        DateTime
							 | 
						|
								  id          String   @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())
							 | 
						|
								  currency      Currency
							 | 
						|
								  dataSource    DataSource @default(YAHOO)
							 | 
						|
								  date          DateTime
							 | 
						|
								  fee           Float
							 | 
						|
								  id            String     @default(uuid())
							 | 
						|
								  quantity      Float
							 | 
						|
								  symbol        String
							 | 
						|
								  type          Type
							 | 
						|
								  unitPrice     Float
							 | 
						|
								  updatedAt     DateTime   @updatedAt
							 | 
						|
								  User          User       @relation(fields: [userId], references: [id])
							 | 
						|
								  userId        String
							 | 
						|
								
							 | 
						|
								  @@id([id, userId])
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Platform {
							 | 
						|
								  Account Account[]
							 | 
						|
								  id      String    @id @default(uuid())
							 | 
						|
								  name    String?
							 | 
						|
								  url     String    @unique
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Property {
							 | 
						|
								  key   String @id
							 | 
						|
								  value String
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model Settings {
							 | 
						|
								  currency  Currency
							 | 
						|
								  updatedAt DateTime @updatedAt
							 | 
						|
								  User      User     @relation(fields: [userId], references: [id])
							 | 
						|
								  userId    String   @id
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								model User {
							 | 
						|
								  Access       Access[]   @relation("accessGet")
							 | 
						|
								  AccessGive   Access[]   @relation(name: "accessGive")
							 | 
						|
								  accessToken  String?
							 | 
						|
								  Account      Account[]
							 | 
						|
								  alias        String?
							 | 
						|
								  Analytics    Analytics?
							 | 
						|
								  createdAt    DateTime   @default(now())
							 | 
						|
								  id           String     @id @default(uuid())
							 | 
						|
								  Order        Order[]
							 | 
						|
								  provider     Provider?
							 | 
						|
								  role         Role       @default(USER)
							 | 
						|
								  Settings     Settings?
							 | 
						|
								  thirdPartyId String?
							 | 
						|
								  updatedAt    DateTime   @updatedAt
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum AccountType {
							 | 
						|
								  SECURITIES
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum Currency {
							 | 
						|
								  CHF
							 | 
						|
								  EUR
							 | 
						|
								  GBP
							 | 
						|
								  USD
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum DataSource {
							 | 
						|
								  ALPHA_VANTAGE
							 | 
						|
								  GHOSTFOLIO
							 | 
						|
								  RAKUTEN
							 | 
						|
								  YAHOO
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum Provider {
							 | 
						|
								  ANONYMOUS
							 | 
						|
								  GOOGLE
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum Role {
							 | 
						|
								  ADMIN
							 | 
						|
								  DEMO
							 | 
						|
								  USER
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								enum Type {
							 | 
						|
								  BUY
							 | 
						|
								  SELL
							 | 
						|
								}
							 | 
						|
								
							 |