mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-24 14:17:47 -06:00
feat: prisma and remove mongodb
This commit is contained in:
@@ -34,9 +34,8 @@ enum TypebotSessionStatus {
|
||||
}
|
||||
|
||||
model Instance {
|
||||
id Int @id @default(autoincrement())
|
||||
id String @id @default(cuid())
|
||||
name String @unique @db.VarChar(255)
|
||||
description String? @db.VarChar(255)
|
||||
connectionStatus InstanceConnectionStatus @default(open)
|
||||
ownerJid String? @db.VarChar(100)
|
||||
profilePicUrl String? @db.VarChar(500)
|
||||
@@ -60,33 +59,31 @@ model Instance {
|
||||
}
|
||||
|
||||
model Session {
|
||||
id Int @id @unique @default(autoincrement())
|
||||
sessionId String @unique @default(cuid())
|
||||
creds String? @db.Text
|
||||
createdAt DateTime @default(now())
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique @db.Integer
|
||||
|
||||
@@map("sessions")
|
||||
id Int @id @unique @default(autoincrement())
|
||||
sessionId String @unique
|
||||
creds String? @db.Text
|
||||
createdAt DateTime @default(now())
|
||||
Instance Instance @relation(fields: [sessionId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model Auth {
|
||||
id Int @id @default(autoincrement())
|
||||
apiKey String @unique
|
||||
apikey String @unique
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime? @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique @db.Integer
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Chat {
|
||||
id Int @id @default(autoincrement())
|
||||
lastMsgTimestamp DateTime? @db.Timestamp
|
||||
remoteJid String @db.VarChar(100)
|
||||
lastMsgTimestamp String? @db.VarChar(100)
|
||||
labels Json? @db.JsonB
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime? @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int
|
||||
instanceId String
|
||||
}
|
||||
|
||||
model Contact {
|
||||
@@ -97,79 +94,77 @@ model Contact {
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime? @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int
|
||||
instanceId String
|
||||
}
|
||||
|
||||
model Message {
|
||||
id Int @id @default(autoincrement())
|
||||
keyId String @db.VarChar(100)
|
||||
keyRemoteJid String @db.VarChar(100)
|
||||
keyFromMe Boolean @db.Boolean
|
||||
keyParticipant String? @db.VarChar(100)
|
||||
key Json @db.JsonB
|
||||
pushName String? @db.VarChar(100)
|
||||
participant String? @db.VarChar(100)
|
||||
messageType String @db.VarChar(100)
|
||||
message Json @db.JsonB
|
||||
contextInfo Json? @db.JsonB
|
||||
source DeviceMessage
|
||||
messageTimestamp Int @db.Integer
|
||||
messageTimestamp String @db.VarChar(100)
|
||||
chatwootMessageId Int? @db.Integer
|
||||
chatwootInboxId Int? @db.Integer
|
||||
chatwootConversationId Int? @db.Integer
|
||||
chatwootContactInboxSourceId String? @db.VarChar(100)
|
||||
chatwotIsRead Boolean? @db.Boolean
|
||||
chatwootIsRead Boolean? @db.Boolean
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int
|
||||
instanceId String
|
||||
typebotSessionId Int?
|
||||
MessageUpdate MessageUpdate[]
|
||||
TypebotSession TypebotSession? @relation(fields: [typebotSessionId], references: [id])
|
||||
|
||||
@@index([keyId], name: "keyId")
|
||||
}
|
||||
|
||||
model MessageUpdate {
|
||||
id Int @id @default(autoincrement())
|
||||
keyId String @db.VarChar(100)
|
||||
remoteJid String @db.VarChar(100)
|
||||
fromMe Boolean @db.Boolean
|
||||
participant String? @db.VarChar(100)
|
||||
dateTime DateTime @db.Date
|
||||
pollUpdates Json? @db.JsonB
|
||||
status String @db.VarChar(30)
|
||||
Message Message @relation(fields: [messageId], references: [id], onDelete: Cascade)
|
||||
messageId Int
|
||||
}
|
||||
|
||||
model Webhook {
|
||||
id Int @id @default(autoincrement())
|
||||
url String @db.VarChar(500)
|
||||
enabled Boolean? @default(true) @db.Boolean
|
||||
events Json? @db.JsonB
|
||||
webhook_by_events Boolean? @default(false) @db.Boolean
|
||||
webhook_base64 Boolean? @default(false) @db.Boolean
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique
|
||||
id Int @id @default(autoincrement())
|
||||
url String @db.VarChar(500)
|
||||
enabled Boolean? @default(true) @db.Boolean
|
||||
events Json? @db.JsonB
|
||||
webhookByEvents Boolean? @default(false) @db.Boolean
|
||||
webhookBase64 Boolean? @default(false) @db.Boolean
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Chatwoot {
|
||||
id Int @id @default(autoincrement())
|
||||
enabled Boolean? @default(true) @db.Boolean
|
||||
account_id String? @db.VarChar(100)
|
||||
token String? @db.VarChar(100)
|
||||
url String? @db.VarChar(500)
|
||||
name_inbox String? @db.VarChar(100)
|
||||
sign_msg Boolean? @default(false) @db.Boolean
|
||||
sign_delimiter String? @db.VarChar(100)
|
||||
number String? @db.VarChar(100)
|
||||
reopen_conversation Boolean? @default(false) @db.Boolean
|
||||
conversation_pending Boolean? @default(false) @db.Boolean
|
||||
merge_brazil_contacts Boolean? @default(false) @db.Boolean
|
||||
import_contacts Boolean? @default(false) @db.Boolean
|
||||
import_messages Boolean? @default(false) @db.Boolean
|
||||
days_limit_import_messages Int? @db.Integer
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique
|
||||
id Int @id @default(autoincrement())
|
||||
enabled Boolean? @default(true) @db.Boolean
|
||||
accountId String? @db.VarChar(100)
|
||||
token String? @db.VarChar(100)
|
||||
url String? @db.VarChar(500)
|
||||
nameInbox String? @db.VarChar(100)
|
||||
signMsg Boolean? @default(false) @db.Boolean
|
||||
signDelimiter String? @db.VarChar(100)
|
||||
number String? @db.VarChar(100)
|
||||
reopenConversation Boolean? @default(false) @db.Boolean
|
||||
conversationPending Boolean? @default(false) @db.Boolean
|
||||
mergeBrazilContacts Boolean? @default(false) @db.Boolean
|
||||
importContacts Boolean? @default(false) @db.Boolean
|
||||
importMessages Boolean? @default(false) @db.Boolean
|
||||
daysLimitImportMessages Int? @db.Integer
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Integration {
|
||||
@@ -180,7 +175,7 @@ model Integration {
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Label {
|
||||
@@ -192,20 +187,20 @@ model Label {
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int
|
||||
instanceId String
|
||||
}
|
||||
|
||||
model Proxy {
|
||||
id Int @id @default(autoincrement())
|
||||
enabled Boolean? @default(true) @db.Boolean
|
||||
proxyHost String? @db.VarChar(100)
|
||||
proxyPort Int? @db.Integer
|
||||
proxyUsername String? @db.VarChar(100)
|
||||
proxyPassword String? @db.VarChar(100)
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique
|
||||
id Int @id @default(autoincrement())
|
||||
enabled Boolean? @default(true) @db.Boolean
|
||||
host String? @db.VarChar(100)
|
||||
port String? @db.VarChar(100)
|
||||
username String? @db.VarChar(100)
|
||||
password String? @db.VarChar(100)
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Setting {
|
||||
@@ -220,7 +215,7 @@ model Setting {
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Rabbitmq {
|
||||
@@ -230,7 +225,7 @@ model Rabbitmq {
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Sqs {
|
||||
@@ -240,7 +235,7 @@ model Sqs {
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Websocket {
|
||||
@@ -250,7 +245,7 @@ model Websocket {
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique
|
||||
instanceId String @unique
|
||||
}
|
||||
|
||||
model Typebot {
|
||||
@@ -266,7 +261,7 @@ model Typebot {
|
||||
createdAt DateTime? @default(now()) @db.Date
|
||||
updatedAt DateTime? @updatedAt @db.Date
|
||||
Instance Instance @relation(fields: [instanceId], references: [id], onDelete: Cascade)
|
||||
instanceId Int @unique
|
||||
instanceId String @unique
|
||||
sessions TypebotSession[]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user