warmbox/prisma/schema.prisma

74 lines
1.7 KiB
Text

generator client {
provider = "prisma-client"
output = "../src/generated/prisma"
}
datasource db {
provider = "sqlite"
}
enum InboxStatus {
active
paused
error
}
enum WarmupStatus {
sent
rescued_from_spam
replied
complete
}
model Inbox {
id String @id @default(cuid())
email String @unique
smtpHost String
smtpPort Int
imapHost String
imapPort Int
username String
password String
status InboxStatus @default(active)
dailyLimit Int @default(40)
currentRamp Int @default(5)
industry String @default("SaaS")
lastError String?
errorAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sentLogs WarmupLog[] @relation("Sender")
receivedLogs WarmupLog[] @relation("Receiver")
@@index([status])
}
model WarmupLog {
id String @id @default(cuid())
senderId String
receiverId String
messageId String?
inReplyTo String?
subject String
body String
status WarmupStatus @default(sent)
rescuedFromSpam Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
sender Inbox @relation("Sender", fields: [senderId], references: [id], onDelete: Cascade)
receiver Inbox @relation("Receiver", fields: [receiverId], references: [id], onDelete: Cascade)
@@index([senderId, status])
@@index([receiverId, status])
@@index([messageId])
}
model Setting {
id String @id @default(cuid())
key String @unique
value String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}