feature(queue): use postgres instead of redis for buffer

* wip(buffer): initial implementation of psql buffer

* wip(buffer): add both profile and bots buffer
This commit is contained in:
Carl-Gerhard Lindesvärd
2025-01-29 15:17:54 +00:00
committed by Carl-Gerhard Lindesvärd
parent 2b5b8ce446
commit 71bf22af51
16 changed files with 19713 additions and 18747 deletions

View File

@@ -443,3 +443,52 @@ model ResetPassword {
@@map("reset_password")
}
model EventBuffer {
id String @id @default(cuid())
projectId String
eventId String @unique
name String
profileId String?
sessionId String?
/// [IPrismaClickhouseEvent]
payload Json
processedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
@@index([projectId, processedAt, createdAt])
@@index([projectId, profileId, sessionId, createdAt])
@@map("event_buffer")
}
model ProfileBuffer {
id String @id @default(cuid())
projectId String
profileId String
checksum String
/// [IPrismaClickhouseProfile]
payload Json
processedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
@@index([projectId, profileId])
@@index([projectId, processedAt])
@@index([checksum])
@@map("profile_buffer")
}
model BotEventBuffer {
id String @id @default(cuid())
projectId String
eventId String
/// [IPrismaClickhouseBotEvent]
payload Json
createdAt DateTime @default(now())
processedAt DateTime?
@@index([processedAt])
@@index([projectId, eventId])
@@map("bot_event_buffer")
}