Skip to content

Instantly share code, notes, and snippets.

@LawJolla
Created May 24, 2022 06:26
Show Gist options
  • Save LawJolla/d053129ad95de3b579705256b006090f to your computer and use it in GitHub Desktop.
Save LawJolla/d053129ad95de3b579705256b006090f to your computer and use it in GitHub Desktop.
Schema from db pull
generator client {
provider = "prisma-client-js"
}
generator nexusPrisma {
provider = "nexus-prisma"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model AccountCheck {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
issuedDate DateTime?
issuedBy String
voidedBy String?
voidDate DateTime?
checkNumber String
amount Int
cachedDate DateTime?
accountId String? @map("account") @db.VarChar(30)
memo String?
account DealerAccount? @relation(fields: [accountId], references: [id], onUpdate: NoAction)
accountTransaction AccountTransaction[]
items TransactionItem[]
}
model AccountTransaction {
id String @id @default(cuid()) @db.VarChar(25)
uniqueTransactionId String @unique(map: "wk$prod.AccountTransaction.uniqueTransactionId._UNIQUE")
createdAt DateTime
updatedAt DateTime @updatedAt
transactionDate DateTime
amount Int
ledgerDescription String?
description String?
chargedBy String?
dealershipId String? @map("dealership") @db.VarChar(25)
accountId String? @map("account") @db.VarChar(25)
pending Boolean
checkId String? @map("check") @db.VarChar(25)
account DealerAccount? @relation(fields: [accountId], references: [id], onUpdate: NoAction)
check AccountCheck? @relation(fields: [checkId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
dealLineItems DealLineItem[]
items TransactionItem[]
}
model Address {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
street String?
city String?
state String?
zip String?
isCurrent Boolean
userId String? @map("user") @db.VarChar(25)
vendorId String? @map("vendor") @db.VarChar(25)
addressType Unsupported("_AddressTypeEnum")[]
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
vendor Vendor? @relation(fields: [vendorId], references: [id], onUpdate: NoAction)
DealerLicensePlateUser DealerLicensePlateUser[]
DriverLicense DriverLicense[]
VehicleBoughtFrom VehicleBoughtFrom[]
deals Deal[]
}
model Advertising {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
facebookId String? @map("facebook") @db.VarChar(25)
vehicleId String? @map("vehicle") @db.VarChar(25)
facebook FacebookAd? @relation("Advertising_facebookToFacebookAd", fields: [facebookId], references: [id], onUpdate: NoAction)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_vehicle")
FacebookAd_AdvertisingToFacebookAd_advertisingId FacebookAd[] @relation("AdvertisingToFacebookAd_advertisingId")
Vehicle_AdvertisingToVehicle_advertising Vehicle[] @relation("AdvertisingToVehicle_advertising")
}
model AutomatedMessage {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
messageType String
sentBy String?
messageId String?
dealId String? @map("deal") @db.VarChar(25)
deal Deal? @relation(fields: [dealId], references: [id], onUpdate: NoAction)
}
model BridgeAccountTransactionToTransactionItem {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
searchString String
accountingType String
dealershipId String? @map("dealership") @db.VarChar(25)
vendorId String? @map("vendor") @db.VarChar(25)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
vendor Vendor? @relation(fields: [vendorId], references: [id], onUpdate: NoAction)
}
model CustomerPlaidAccount {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
institution String?
accounts String?
link_session_id String
access_token String?
stripeToken String?
stripeResponse String?
userId String? @map("user") @db.VarChar(25)
selectedAccountId String?
balance Int?
balanceDate DateTime?
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
}
model CustomerVehicleSearch {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
search String
name String
viewCount Int?
isDeleted Boolean?
userId String? @map("user") @db.VarChar(25)
notifications Unsupported("_CustomVehicleSearchNotificationOptionsEnum")[]
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
}
model Date {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
date DateTime
label String
isUpcoming Boolean
isForDealership Boolean
dateType String?
actionId String? @map("action") @db.VarChar(25)
dealId String? @map("deal") @db.VarChar(25)
action DealAction? @relation(fields: [actionId], references: [id], onUpdate: NoAction)
deal Deal? @relation(fields: [dealId], references: [id], onUpdate: NoAction)
}
model Deal {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
dealType String?
deliveryType String?
registeringStateEnum String
updatedAt DateTime @updatedAt
isUserOnboarded Boolean
questions String?
offerStatus String?
status String?
storeId String? @map("store") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
automatedMessages AutomatedMessage[]
dates Date[]
actions DealAction[]
addOns DealAddOn[]
lineItems DealLineItem[] @relation("DeaLineItems")
docs Doc[]
files File[]
notes Note[]
offers Offer[]
tasks Task[]
addresses Address[]
signers Signer[] @relation("DealSigner")
emailAddresses EmailAddress[]
phoneNumbers PhoneNumber[]
trades Trade[]
users User[]
vehicles Vehicle[]
}
model DealAction {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
label String
description String?
customerDescription String?
actionType String
isInternal Boolean?
isVisible Boolean?
isActionable Boolean?
isComplete Boolean?
isDefault Boolean?
completedDate DateTime?
timeToComplete DateTime?
meta String?
userView String
noDealDuplicates Boolean?
vehicleId String? @map("vehicle") @db.VarChar(25)
dealId String? @map("deal") @db.VarChar(25)
addOnId String? @map("addOn") @db.VarChar(25)
inheritsFromId String? @map("inheritsFrom") @db.VarChar(25)
storeId String? @map("store") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
addOn DealAddOn? @relation(fields: [addOnId], references: [id], onUpdate: NoAction)
deal Deal? @relation(fields: [dealId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
inheritsFrom DealAction? @relation("DealActionToDealAction_inheritsFrom", fields: [inheritsFromId], references: [id], onUpdate: NoAction)
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
dates Date[]
inheritsTo DealAction[] @relation("DealActionToDealAction_inheritsFrom")
lineItems DealLineItem[]
}
model DealAddOn {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
persistOnDeal Boolean?
onePerDeal Boolean?
label String
customerComponent String?
description String?
addToDeal Boolean?
isAccepted Boolean?
isAcceptedDate DateTime?
isRequired Boolean?
isDefault Boolean?
storeId String? @map("store") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
inheritsFrom String? @db.VarChar(25)
dealId String? @map("deal") @db.VarChar(25)
vehicleId String? @map("vehicle") @db.VarChar(25)
title String?
estimatedCompletionTime String?
conditionals String?
addedBy String?
benefits String[]
images String[]
inheritsFromId String? @db.VarChar(25)
deal Deal? @relation(fields: [dealId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
DealAddOn_DealAddOnToDealAddOn_inheritsFrom DealAddOn? @relation("DealAddOnToDealAddOn_inheritsFrom", fields: [inheritsFrom], references: [id], onUpdate: NoAction)
inheritsFrom DealAddOn? @relation("DealAddOnToDealAddOn_inheritsFrom", fields: [inheritsFromId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_dealaddon")
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
actions DealAction[]
other_DealAddOn_DealAddOnToDealAddOn_inheritsFrom DealAddOn[] @relation("DealAddOnToDealAddOn_inheritsFrom")
inheritsTo DealAddOn[] @relation("DealAddOnToDealAddOn_inheritsFrom")
lineItems DealLineItem[]
tasks Task[]
DealLineItem_DealAddOnLineItems DealLineItem[] @relation("DealAddOnLineItems")
docs Doc[]
}
model DealerAccount {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
institutionName String
accountName String
accountType String
dealershipsNameForThisAccount String?
lastFour String?
available Int
limit Int?
dealershipId String? @map("dealership") @db.VarChar(25)
plaid String? @db.VarChar(25)
permissions Unsupported("_RolesEnum")[]
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
PlaidAccount PlaidAccount? @relation(fields: [plaid], references: [id], onUpdate: NoAction)
checks AccountCheck[]
transactions AccountTransaction[]
}
model DealerLicensePlate {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
plateNumber String
isActive Boolean
storeId String? @map("store") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
licensePlateLogs DealerLicensePlateLog[]
}
model DealerLicensePlateLog {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
checkout DateTime
returned DateTime?
storeId String? @map("store") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
plateUserId String? @map("plateUser") @db.VarChar(25)
dealerLicensePlateId String? @map("dealerLicensePlate") @db.VarChar(25)
userId String? @map("user") @db.VarChar(25)
vehicleId String? @map("vehicle") @db.VarChar(25)
checkoutMileage Int?
returnedMileage Int?
dealerLicensePlateUserId String? @map("dealerLicensePlateUser") @db.VarChar(25)
dealerLicensePlate DealerLicensePlate? @relation(fields: [dealerLicensePlateId], references: [id], onUpdate: NoAction)
DealerLicensePlateUser_DealerLicensePlateLog_dealerLicensePlateUserToDealerLicensePlateUser DealerLicensePlateUser? @relation("DealerLicensePlateLog_dealerLicensePlateUserToDealerLicensePlateUser", fields: [dealerLicensePlateUserId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
plateUser DealerLicensePlateUser? @relation("DealerLicensePlateLog_plateUserToDealerLicensePlateUser", fields: [plateUserId], references: [id], onUpdate: NoAction, map: "DealerLicensePlateLog_user_fkey")
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction, map: "DealerLicensePlateLog_user_fkey1")
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
}
model DealerLicensePlateUser {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
name String
searchableName String
addressId String? @map("address") @db.VarChar(25)
userId String? @map("user") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
driverLicenseId String? @map("driverLicense") @db.VarChar(25)
address Address? @relation(fields: [addressId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
driverLicense DriverLicense? @relation(fields: [driverLicenseId], references: [id], onUpdate: NoAction)
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
DealerLicensePlateLog_DealerLicensePlateLog_dealerLicensePlateUserToDealerLicensePlateUser DealerLicensePlateLog[] @relation("DealerLicensePlateLog_dealerLicensePlateUserToDealerLicensePlateUser")
checkouts DealerLicensePlateLog[] @relation("DealerLicensePlateLog_plateUserToDealerLicensePlateUser")
}
model Dealership {
id String @id @default(cuid()) @db.VarChar(30)
name String @unique(map: "wk$prod.Dealership.name._UNIQUE")
phone String?
email String? @unique(map: "wk$prod.Dealership.email._UNIQUE")
slug String @unique(map: "wk$prod.Dealership.slug._UNIQUE")
isActive Boolean
createdAt DateTime
updatedAt DateTime @updatedAt
customerPayment String?
host String? @unique(map: "wk$prod.Dealership.host._UNIQUE")
state String
transactions AccountTransaction[]
BridgeAccountTransactionToTransactionItem BridgeAccountTransactionToTransactionItem[]
deals Deal[]
actions DealAction[]
addOns DealAddOn[]
accounts DealerAccount[]
licensePlates DealerLicensePlate[]
licensePlateLogs DealerLicensePlateLog[]
licensePlateUsers DealerLicensePlateUser[]
dealershipFloorPlans DealershipFloorPlan[]
integrations DealershipIntegration[]
lineItems DealLineItem[]
docs Doc[]
emailSubscribers EmailSubscriber[]
facebookAdGroups FacebookAdGroup[]
files File[]
notes Note[]
user Permission[]
plaidAccounts PlaidAccount[]
siteBanners SiteBanner[]
stores Store[]
tasks Task[]
TransactionItem TransactionItem[]
allowedTransactionTypes TransactionTypeAllowedList[]
User_DealershipToUser_dealership User[] @relation("DealershipToUser_dealership")
workers User[] @relation("DealershipToUser_worksFor")
vehicles Vehicle[]
vendors Vendor[]
webUpdates WebUpdate[]
}
model DealershipFloorPlan {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
username String?
password String?
floorPlanProviderId String? @map("floorPlanProvider") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
loginError Boolean?
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
floorPlanProvider FloorPlanProvider? @relation(fields: [floorPlanProviderId], references: [id], onUpdate: NoAction)
}
model DealershipIntegration {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
username String?
password String?
loginError Boolean?
loginErrorMessage String?
isActive Boolean
dealershipId String? @map("dealership") @db.VarChar(25)
serviceId String? @map("service") @db.VarChar(25)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
service DealershipIntegrationService? @relation(fields: [serviceId], references: [id], onUpdate: NoAction)
}
model DealershipIntegrationService {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
label String
service String?
isActive Boolean
status String?
statusMessage String?
authenticationType String
dealerships DealershipIntegration[]
}
model DealLineItem {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
amount Int
ledgerType String
label String
isTaxable Boolean?
allowCreditCardPayment Boolean?
lineItemType String?
meta String?
transactionId String? @map("transaction") @db.VarChar(25)
actionId String? @map("action") @db.VarChar(25)
storeId String? @map("store") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
dealId String? @map("deal") @db.VarChar(25)
conditionals String?
modifyBaseAmount String?
persistOnDeal Boolean?
limitOnePerDeal Boolean?
taskId String? @map("task") @db.VarChar(25)
vehicleFeeId String? @map("vehicleFee") @db.VarChar(25)
inheritsFromId String? @map("inheritsFrom") @db.VarChar(25)
excludeFrom String[]
dealAddOnId String? @map("dealAddOn") @db.VarChar(25)
action DealAction? @relation(fields: [actionId], references: [id], onUpdate: NoAction)
deal Deal? @relation("DeaLineItems", fields: [dealId], references: [id], onUpdate: NoAction)
dealAddOn DealAddOn? @relation(fields: [dealAddOnId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_author")
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
inheritsFrom DealLineItem? @relation("DealLineItemToDealLineItem_inheritsFrom", fields: [inheritsFromId], references: [id], onUpdate: NoAction)
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
task Task? @relation(fields: [taskId], references: [id], onUpdate: NoAction)
transaction AccountTransaction? @relation(fields: [transactionId], references: [id], onUpdate: NoAction)
vehicleFee Vehicle? @relation(fields: [vehicleFeeId], references: [id], onUpdate: NoAction)
inheritsFromOpposite DealLineItem[] @relation("DealLineItemToDealLineItem_inheritsFrom")
DealAddOn_DealAddOnLineItems DealAddOn[] @relation("DealAddOnLineItems")
}
model defaultArray {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
}
model defaultString {
id String @id @default(cuid()) @db.VarChar(25)
value String
createdAt DateTime
updatedAt DateTime @updatedAt
}
model Device {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
uuid String? @unique(map: "wk$prod.Device.uuid._UNIQUE")
userAgent String?
IP String?
users User[]
}
model Disclosure {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
text String
showInDocs Boolean
headline String
component String?
Vehicle Vehicle[]
}
model Doc {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
docType String
docIsFor String
label String
component String?
additionalContent String?
isDefault Boolean?
meta String?
storeId String? @map("store") @db.VarChar(30)
dealId String? @map("deal") @db.VarChar(30)
inheritsFromId String? @map("inheritsFrom") @db.VarChar(30)
dealershipId String? @map("dealership") @db.VarChar(30)
vehicleId String? @map("vehicle") @db.VarChar(30)
completedFileId String? @map("completedFile") @db.VarChar(30)
canElectronicallySign Boolean?
completedFile File? @relation(fields: [completedFileId], references: [id], onUpdate: NoAction)
deal Deal? @relation(fields: [dealId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
inheritsFrom Doc? @relation("DocToDoc_inheritsFrom", fields: [inheritsFromId], references: [id], onUpdate: NoAction)
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
inheritsFromOpposite Doc[] @relation("DocToDoc_inheritsFrom")
signed SignedDoc[]
DealAddOn DealAddOn[]
File_DocFile File[] @relation("DocFile")
signers Signer[]
users User[]
}
model DriverLicense {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
name String
addressId String? @map("address") @db.VarChar(25)
fileId String? @map("file") @db.VarChar(25)
expires DateTime?
height String?
weight String?
DOB DateTime?
sex String?
issueDate String?
eyeColor String?
number String?
meta String?
state String?
address Address? @relation(fields: [addressId], references: [id], onUpdate: NoAction)
file File? @relation(fields: [fileId], references: [id], onUpdate: NoAction)
DealerLicensePlateUser DealerLicensePlateUser[]
User User[]
}
model ElectronicSignatureConsent {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
ip String?
signer Signer[]
}
model EmailAddress {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
name String?
email String
emailOwnerEnum String
userId String? @map("user") @db.VarChar(25)
emailType Unsupported("_EmailTypeEnum")[]
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
deals Deal[]
}
model EmailSubscriber {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
email String
subscriptionType String
isSubscribed Boolean
userId String? @map("user") @db.VarChar(25)
dealerId String? @map("dealer") @db.VarChar(25)
isEmailVerified Boolean?
signupDate DateTime?
lastOpenedDate DateTime?
lastClickedDate DateTime?
emailsReceived Int?
emailsOpened Int?
emailsClicked Int?
tags String[]
dealer Dealership? @relation(fields: [dealerId], references: [id], onUpdate: NoAction)
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
}
model FacebookAd {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
isActive Boolean
adgroups String[]
adGroups String[]
advertisingId String? @db.VarChar(25)
Advertising_AdvertisingToFacebookAd_advertisingId Advertising? @relation("AdvertisingToFacebookAd_advertisingId", fields: [advertisingId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "fk_advertising")
advertising Advertising[] @relation("Advertising_facebookToFacebookAd")
}
model FacebookAdGroup {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
adGroup String?
dealershipId String? @map("dealership") @db.VarChar(25)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
}
model File {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
Key String? @unique(map: "wk$prod.File.Key._UNIQUE")
displayName String
internalName String?
Bucket String?
description String?
fileType String
meta String?
userId String? @map("user") @db.VarChar(25)
vehicleId String? @map("vehicle") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
storeId String? @map("store") @db.VarChar(25)
signerId String? @map("signer") @db.VarChar(25)
dealId String? @map("deal") @db.VarChar(25)
access Unsupported("_RolesEnum")[]
tags Unsupported("_FileTagEnum")[]
deal Deal? @relation(fields: [dealId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
signer Signer? @relation(fields: [signerId], references: [id], onUpdate: NoAction)
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
completedFile Doc[]
DriverLicense DriverLicense[]
Doc_DocFile Doc[] @relation("DocFile")
}
model FloorPlan {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
floorPlanId String
floorPlanStockNo String
vehicleFloorAmount Int
principle Int
payoff Int
isPaid Boolean?
titleStatus String?
meta String?
floorPlanProviderId String? @map("floorPlanProvider") @db.VarChar(25)
floorDate DateTime
feeTotal Int
interestTotal Int
nextPaymentDate DateTime?
nextPaymentAmount Int?
paidDate DateTime?
floorPlanProvider FloorPlanProvider? @relation(fields: [floorPlanProviderId], references: [id], onUpdate: NoAction)
floorPlanActions FloorPlanAction[]
lineItems FloorPlanLineItem[]
Vehicle Vehicle[]
}
model FloorPlanAction {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
name String
value String?
isComplete Boolean?
dueDate DateTime?
meta String?
floorplanId String? @map("floorplan") @db.VarChar(25)
floorplan FloorPlan? @relation(fields: [floorplanId], references: [id], onUpdate: NoAction)
}
model FloorPlanLineItem {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
name String
amount Int
lineItemLabel String
lineItemTypeType String
floorPlanId String? @map("floorPlan") @db.VarChar(25)
floorPlan FloorPlan? @relation(fields: [floorPlanId], references: [id], onUpdate: NoAction)
}
model FloorPlanProvider {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
name String
dealershipFloorPlans DealershipFloorPlan[]
floorPlans FloorPlan[]
}
model InAppNotification {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
isRead Boolean
userId String? @map("user") @db.VarChar(25)
notificationId String? @map("notification") @db.VarChar(25)
notification Notification? @relation(fields: [notificationId], references: [id], onUpdate: NoAction)
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
}
model Note {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
text String
vehicleId String? @map("vehicle") @db.VarChar(25)
fromId String? @map("from") @db.VarChar(25)
dealId String? @map("deal") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
tags String[]
deal Deal? @relation(fields: [dealId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
from User? @relation(fields: [fromId], references: [id], onUpdate: NoAction)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
}
model Notification {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
title String
description String
image String?
link String?
notificationId String
inAppNotifications InAppNotification[]
}
model Offer {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
type String
amount Int
dealId String? @map("deal") @db.VarChar(25)
deal Deal? @relation(fields: [dealId], references: [id], onUpdate: NoAction)
}
model Permission {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
userId String? @map("user") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
role String
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
}
model PhoneNumber {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
phoneNumber String
contactName String?
businessName String?
phoneNumberOwnerEnum String
phoneNumberType String
mobileCarrier String?
country String?
userId String? @map("user") @db.VarChar(25)
vendorId String? @map("vendor") @db.VarChar(25)
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
vendor Vendor? @relation(fields: [vendorId], references: [id], onUpdate: NoAction)
deals Deal[]
physicalAccess PhysicalAccess[]
}
model PhysicalAccess {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
accessControl String
startDate DateTime
endDate DateTime
expiresAfterStart Int?
userId String? @map("user") @db.VarChar(25)
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
logs PhysicalAccessLog[]
phoneNumbers PhoneNumber[]
}
model PhysicalAccessLog {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
action String
accessId String? @map("access") @db.VarChar(25)
access PhysicalAccess? @relation(fields: [accessId], references: [id], onUpdate: NoAction)
}
model PlaidAccount {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
accessToken String
accountId String @unique(map: "wk$prod.PlaidAccount.accountId._UNIQUE")
itemId String?
name String
type String?
subtype String?
officialName String?
dealershipId String? @map("dealership") @db.VarChar(25)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
dealerAccount DealerAccount[]
}
model SignedDoc {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
ip String?
docSignatureId String
docId String? @map("doc") @db.VarChar(25)
signerId String? @map("signer") @db.VarChar(25)
doc Doc? @relation(fields: [docId], references: [id], onUpdate: NoAction)
signer Signer? @relation(fields: [signerId], references: [id], onUpdate: NoAction)
}
model Signer {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
name String
registerName String?
userId String? @map("user") @db.VarChar(25)
electronicConsentId String? @map("electronicConsent") @db.VarChar(25)
signerTags Unsupported("_SignerTagEnum")[]
electronicConsent ElectronicSignatureConsent? @relation(fields: [electronicConsentId], references: [id], onUpdate: NoAction)
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
signatureFiles File[]
usedToSign SignedDoc[]
SignerTag SignerTag[]
deals Deal[] @relation("DealSigner")
docs Doc[]
}
model SignerTag {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
tag String?
signerId String? @map("signer") @db.VarChar(25)
signer Signer? @relation(fields: [signerId], references: [id], onUpdate: NoAction)
}
model SiteBanner {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
text String
link String?
allowClose Boolean?
startAt DateTime
stopAt DateTime
dealershipId String? @map("dealership") @db.VarChar(25)
colorScheme String
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
}
model Store {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
name String
publicName String?
legalName String?
street String?
city String?
state String?
zip String?
phone String?
internalName String?
isActive Boolean
dealershipId String? @map("dealership") @db.VarChar(25)
slug String @unique(map: "wk$prod.Store.slug._UNIQUE")
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
deals Deal[]
actions DealAction[]
addOns DealAddOn[]
licensePlates DealerLicensePlate[]
licensePlateLog DealerLicensePlateLog[]
DealLineItem DealLineItem[]
docs Doc[]
files File[]
tasks Task[]
vehicles Vehicle[]
vehicleTaxPolicies VehicleTaxPolicy[]
}
model Task {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
uniqueId String @unique(map: "wk$prod.Task.uniqueId._UNIQUE")
label String?
order Int?
status String
userViewCompleted Boolean
isRequired Boolean
isComplete Boolean
completeBy DateTime?
scheduledFor DateTime?
completedAt DateTime?
isActive Boolean
showCustomer Boolean
taskData String?
uiData String?
customerUI String
dealerUI String
addOnsId String? @map("addOns") @db.VarChar(25)
dealId String? @map("deal") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
storeId String? @map("store") @db.VarChar(25)
vehicleId String? @map("vehicle") @db.VarChar(25)
isFor Unsupported("_DealTaskIsForEnum")[]
eventFor Unsupported("_EventEnum")[]
addOns DealAddOn? @relation(fields: [addOnsId], references: [id], onUpdate: NoAction)
deal Deal? @relation(fields: [dealId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
lineItems DealLineItem[]
alertIndividualUsers User[] @relation("UserTask")
}
model Trade {
id String @id @default(cuid()) @db.VarChar(25)
year Int
make String
createdAt DateTime
updatedAt DateTime @updatedAt
model String?
vin String?
tradeValue Int
deals Deal[]
}
model TransactionItem {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
description String
amount Int
vendorId String? @map("vendor") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
accountTransactionId String? @map("accountTransaction") @db.VarChar(25)
accountingType String
checkId String? @map("check") @db.VarChar(25)
belongsTo Unsupported("_RolesEnum")[]
accountTransaction AccountTransaction? @relation(fields: [accountTransactionId], references: [id], onUpdate: NoAction)
check AccountCheck? @relation(fields: [checkId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
vendor Vendor? @relation(fields: [vendorId], references: [id], onUpdate: NoAction)
vehicleRecon VehicleRecon[]
}
model TransactionTypeAllowedList {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
name String
isReconType Boolean
dealershipId String? @map("dealership") @db.VarChar(25)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
}
model User {
id String @id @default(cuid()) @db.VarChar(30)
email String?
name String?
phone String?
identity String?
avatar String?
auth0id String?
createdAt DateTime
updatedAt DateTime @updatedAt
meta String?
dealershipId String? @map("dealership") @db.VarChar(25)
worksForId String? @map("worksFor") @db.VarChar(25)
driverLicenseId String? @map("driverLicense") @db.VarChar(25)
dummyString String?
Dealership_DealershipToUser_dealership Dealership? @relation("DealershipToUser_dealership", fields: [dealershipId], references: [id], onUpdate: NoAction)
driverLicense DriverLicense? @relation(fields: [driverLicenseId], references: [id], onUpdate: NoAction)
worksFor Dealership? @relation("DealershipToUser_worksFor", fields: [worksForId], references: [id], onUpdate: NoAction)
addresses Address[]
plaidAccounts CustomerPlaidAccount[]
savedVehicleSearches CustomerVehicleSearch[]
licensePlateLog DealerLicensePlateLog[]
DealerLicensePlateUser DealerLicensePlateUser[]
emailAddresses EmailAddress[]
emailSubscribers EmailSubscriber[]
files File[]
notifications InAppNotification[]
notes Note[]
permissions Permission[]
phoneNumbers PhoneNumber[]
physicalAccess PhysicalAccess[]
signers Signer[]
notificationSubscriptions UserNotificationPreference[]
VehiclePrice VehiclePrice[]
deals Deal[]
devices Device[]
docs Doc[]
tasks Task[] @relation("UserTask")
}
model UserNotificationPreference {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
event String
userId String? @map("user") @db.VarChar(25)
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
}
model Vehicle {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
stockNo String
year Int
make String
model String?
trim String?
image String?
vin String?
fuel String?
color String?
tempColor String?
transmission String?
driveline String?
title String?
mileageStatus String?
mileage Int?
status String
vehicleBoughtFromId String? @map("vehicleBoughtFrom") @db.VarChar(25)
storeId String? @map("store") @db.VarChar(25)
dealershipId String? @map("dealership") @db.VarChar(25)
tempVehicleBoughtFrom String?
tempVehicleBoughtFromLocation String?
tempVehicleBoughtFromType String?
sentIsOnlineNotification Boolean
kbbOptions String?
trim2 String?
advertisingId String? @map("advertising") @db.VarChar(25)
titleHistoryTags Unsupported("_TitleHistoryEnum")[]
vehicleTypes Unsupported("_VehicleTypeEnum")[]
Advertising_AdvertisingToVehicle_advertising Advertising? @relation("AdvertisingToVehicle_advertising", fields: [advertisingId], references: [id], onUpdate: NoAction)
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
vehicleBoughtFrom VehicleBoughtFrom? @relation(fields: [vehicleBoughtFromId], references: [id], onUpdate: NoAction)
advertising Advertising[]
actions DealAction[]
addOns DealAddOn[]
plateLog DealerLicensePlateLog[]
dealFees DealLineItem[]
docs Doc[]
files File[]
notes Note[]
tasks Task[]
dates VehicleDates[]
images VehicleImage[]
vehicleOptions VehicleOption[]
prices VehiclePrice[]
recon VehicleRecon[]
videos VehicleVideo[]
deals Deal[]
disclosures Disclosure[]
floorPlans FloorPlan[]
}
model VehicleBoughtFrom {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
vehicleBoughtFromType String
addressId String? @map("address") @db.VarChar(25)
vendorId String? @map("vendor") @db.VarChar(25)
address Address? @relation(fields: [addressId], references: [id], onUpdate: NoAction)
vendor Vendor? @relation(fields: [vendorId], references: [id], onUpdate: NoAction)
vehicle Vehicle[]
}
model VehicleDates {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
date DateTime
dateType String
vehicleId String? @map("vehicle") @db.VarChar(25)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
}
model VehicleHistoryReport {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
mobile String?
desktop String?
pdf String?
vin String
year Int?
make String?
model String?
drivetrain String?
fuel String?
color String?
transmission String?
vehicleType String?
price Int?
viewCount Int?
}
model VehicleImage {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
vehicleId String? @map("vehicle") @db.VarChar(25)
order Int?
url String
description String?
originalUrl String
access Unsupported("_RolesEnum")[]
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
tags VehicleImageTag[]
}
model VehicleImageTag {
id String @id @default(cuid()) @db.VarChar(30)
createdAt DateTime
updatedAt DateTime @updatedAt
tag String
imageId String? @map("image") @db.VarChar(25)
image VehicleImage? @relation(fields: [imageId], references: [id], onUpdate: NoAction)
}
model VehicleOption {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
option String
hasOption Boolean
vehicleId String? @map("vehicle") @db.VarChar(25)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
vehicleOptionTags VehicleOptionTag[]
}
model VehicleOptionTag {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
tag String
vehicleOptionId String? @map("vehicleOption") @db.VarChar(25)
vehicleOption VehicleOption? @relation(fields: [vehicleOptionId], references: [id], onUpdate: NoAction)
}
model VehiclePrice {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
price Int
priceType String
userId String? @map("user") @db.VarChar(25)
vehicleId String? @map("vehicle") @db.VarChar(25)
startDate DateTime?
endDate DateTime?
user User? @relation(fields: [userId], references: [id], onUpdate: NoAction)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
}
model VehicleRecon {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
chargedDate DateTime
type String?
vendorName String?
amount Int
description String?
vehicleId String? @map("vehicle") @db.VarChar(25)
vendorId String? @map("vendor") @db.VarChar(25)
bankLinkId String? @map("bankLink") @db.VarChar(25)
accountingType String?
bankLink TransactionItem? @relation(fields: [bankLinkId], references: [id], onUpdate: NoAction)
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
vendor Vendor? @relation(fields: [vendorId], references: [id], onUpdate: NoAction)
}
model VehicleTaxPolicy {
id String @id @default(cuid()) @db.VarChar(25)
type String
name String
displayName String
formula String?
createdAt DateTime
updatedAt DateTime @updatedAt
storeId String? @map("store") @db.VarChar(25)
store Store? @relation(fields: [storeId], references: [id], onUpdate: NoAction)
}
model VehicleVideo {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
raw String?
high String?
medium String?
low String?
embed String?
label String?
vehicleId String? @map("vehicle") @db.VarChar(25)
videoType Unsupported("_VehicleVideoTypeEnum")[]
vehicle Vehicle? @relation(fields: [vehicleId], references: [id], onUpdate: NoAction)
}
model Vendor {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
name String
email String?
contactName String?
dealershipId String? @map("dealership") @db.VarChar(25)
defaultAccountingType String?
defaultTransactionItemBelongsTo Unsupported("_RolesEnum")[]
dealership Dealership? @relation(fields: [dealershipId], references: [id], onUpdate: NoAction)
addresses Address[]
bridgeToAccountTransactions BridgeAccountTransactionToTransactionItem[]
phoneNumbers PhoneNumber[]
transactions TransactionItem[]
vehicleBoughtFrom VehicleBoughtFrom[]
recon VehicleRecon[]
}
model WebUpdate {
id String @id @default(cuid()) @db.VarChar(25)
createdAt DateTime
updatedAt DateTime @updatedAt
image String
updateDate DateTime
imageCover String?
text String
updateType String
href String
dealerId String? @map("dealer") @db.VarChar(25)
dealer Dealership? @relation(fields: [dealerId], references: [id], onUpdate: NoAction)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment