datasource db { provider = "postgresql" url = env("DATABASE_URL") directUrl = env("DIRECT_URL") } generator client { provider = "prisma-client-js" binaryTargets = ["native", "debian-openssl-1.1.x"] previewFeatures = ["tracing"] } model User { id String @id @default(cuid()) email String @unique authenticationMethod AuthenticationMethod authenticationProfile Json? authenticationExtraParams Json? authIdentifier String? @unique displayName String? name String? avatarUrl String? admin Boolean @default(false) /// Preferences for the dashboard dashboardPreferences Json? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt /// @deprecated isOnCloudWaitlist Boolean @default(false) /// @deprecated featureCloud Boolean @default(false) /// @deprecated isOnHostedRepoWaitlist Boolean @default(false) marketingEmails Boolean @default(true) confirmedBasicDetails Boolean @default(false) referralSource String? personalAccessTokens PersonalAccessToken[] } enum AuthenticationMethod { GOOGLE } /// Used to generate PersonalAccessTokens, they're one-time use model AuthorizationCode { id String @id @default(cuid()) code String @unique personalAccessToken PersonalAccessToken? @relation(fields: [personalAccessTokenId], references: [id], onDelete: Cascade, onUpdate: Cascade) personalAccessTokenId String? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt } // Used by User's to perform API actions model PersonalAccessToken { id String @id @default(cuid()) /// If generated by the CLI this will be "cli", otherwise user-provided name String /// This is the token encrypted using the ENCRYPTION_KEY encryptedToken Json /// This is shown in the UI, with ******** obfuscatedToken String /// This is used to find the token in the database hashedToken String @unique user User @relation(fields: [userId], references: [id]) userId String revokedAt DateTime? lastAccessedAt DateTime? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt authorizationCodes AuthorizationCode[] }