Track HiveGrid Cloud planning reference

This commit is contained in:
david committed 2026-06-26 20:48:01 +02:00
1 parent b3d5ea6764
commit e341c5938a
5784 files changed
+1104929 -3

No files matched your search

@@ -0,0 +1,38 @@
// Outbox-Event pattern: side-effects committed atomically with DB writes.
// Dispatcher worker (apps/worker/src/outbox/dispatcher.ts) polls PENDING rows
// and routes them to BullMQ queues by `eventType` prefix.
//
// See docs/improvement-plan/03-scaling-infrastructure/outbox-pattern.md and
// docs/architecture/outbox-pattern.md.
model OutboxEvent {
id String @id @default(cuid())
tenantId String?
eventType String
payload Json
status OutboxStatus @default(PENDING)
createdAt DateTime @default(now())
processedAt DateTime?
retries Int @default(0)
lastError String?
scheduledAt DateTime @default(now())
dispatchKey String?
priority Int @default(0)
lockedUntil DateTime?
@@unique([dispatchKey])
@@index([status, scheduledAt])
@@index([tenantId, eventType])
@@index([status, priority, createdAt])
@@index([status, lockedUntil], name: "outbox_event_status_locked_until_idx")
@@index([status, priority(sort: Desc), createdAt], name: "outbox_event_status_priority_created_at_desc_idx")
@@index([status, processedAt], name: "outbox_event_status_processed_at_idx")
}
enum OutboxStatus {
PENDING
PROCESSING
DONE
FAILED
CANCELLED
}