@ -180,6 +180,7 @@ model Typebot {
|
||||
name String @db.VarChar(255)
|
||||
folderId String?
|
||||
groups Json
|
||||
events Json?
|
||||
variables Json
|
||||
edges Json
|
||||
theme Json
|
||||
@ -237,6 +238,7 @@ model PublicTypebot {
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
typebotId String @unique
|
||||
groups Json
|
||||
events Json?
|
||||
variables Json
|
||||
edges Json
|
||||
theme Json
|
||||
@ -245,21 +247,31 @@ model PublicTypebot {
|
||||
}
|
||||
|
||||
model Result {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
typebotId String
|
||||
variables Json
|
||||
isCompleted Boolean
|
||||
hasStarted Boolean?
|
||||
isArchived Boolean? @default(false)
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
isArchived Boolean? @default(false)
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
answers Answer[]
|
||||
logs Log[]
|
||||
edges VisitedEdge[]
|
||||
|
||||
@@index([typebotId, isArchived, hasStarted, createdAt(sort: Desc)])
|
||||
@@index([typebotId, isArchived, isCompleted])
|
||||
}
|
||||
|
||||
model VisitedEdge {
|
||||
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
|
||||
resultId String
|
||||
edgeId String
|
||||
index Int
|
||||
|
||||
@@unique([resultId, index])
|
||||
}
|
||||
|
||||
model Log {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
|
@ -22,6 +22,6 @@
|
||||
"prisma": "5.0.0",
|
||||
"@typebot.io/tsconfig": "workspace:*",
|
||||
"tsx": "3.12.7",
|
||||
"typescript": "5.1.6"
|
||||
"typescript": "5.2.2"
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "PublicTypebot" ADD COLUMN "events" JSONB;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "Typebot" ADD COLUMN "events" JSONB;
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "VisitedEdge" (
|
||||
"resultId" TEXT NOT NULL,
|
||||
"edgeId" TEXT NOT NULL,
|
||||
"index" INTEGER NOT NULL
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "VisitedEdge_resultId_index_key" ON "VisitedEdge"("resultId", "index");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "VisitedEdge" ADD CONSTRAINT "VisitedEdge_resultId_fkey" FOREIGN KEY ("resultId") REFERENCES "Result"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
@ -164,6 +164,7 @@ model Typebot {
|
||||
name String
|
||||
folderId String?
|
||||
groups Json
|
||||
events Json?
|
||||
variables Json
|
||||
edges Json
|
||||
theme Json
|
||||
@ -218,6 +219,7 @@ model PublicTypebot {
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
typebotId String @unique
|
||||
groups Json
|
||||
events Json?
|
||||
variables Json
|
||||
edges Json
|
||||
theme Json
|
||||
@ -226,21 +228,31 @@ model PublicTypebot {
|
||||
}
|
||||
|
||||
model Result {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
typebotId String
|
||||
variables Json
|
||||
isCompleted Boolean
|
||||
hasStarted Boolean?
|
||||
isArchived Boolean? @default(false)
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
isArchived Boolean? @default(false)
|
||||
typebot Typebot @relation(fields: [typebotId], references: [id], onDelete: Cascade)
|
||||
answers Answer[]
|
||||
logs Log[]
|
||||
edges VisitedEdge[]
|
||||
|
||||
@@index([typebotId, hasStarted, createdAt(sort: Desc)])
|
||||
@@index([typebotId, isCompleted])
|
||||
}
|
||||
|
||||
model VisitedEdge {
|
||||
result Result @relation(fields: [resultId], references: [id], onDelete: Cascade)
|
||||
resultId String
|
||||
edgeId String
|
||||
index Int
|
||||
|
||||
@@unique([resultId, index])
|
||||
}
|
||||
|
||||
model Log {
|
||||
id String @id @default(cuid())
|
||||
createdAt DateTime @default(now())
|
||||
|
Reference in New Issue
Block a user