feat(calendar): add error tracking with attempts to SelectedCalendar (#21326)
Co-authored-by: [email protected] <[email protected]> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: Omar López <[email protected]>
This commit is contained in:
7 files changed
+146
-32
No files matched your search
+14
@@ -0,0 +1,14 @@
|
||||
-- DropIndex
|
||||
DROP INDEX "SelectedCalendar_integration_idx";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "SelectedCalendar" ADD COLUMN "lastErrorAt" TIMESTAMP(3),
|
||||
ADD COLUMN "maxAttempts" INTEGER NOT NULL DEFAULT 3,
|
||||
ADD COLUMN "unwatchAttempts" INTEGER NOT NULL DEFAULT 0,
|
||||
ADD COLUMN "watchAttempts" INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "SelectedCalendar_watch_idx" ON "SelectedCalendar"("integration", "googleChannelExpiration", "error", "watchAttempts", "maxAttempts");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "SelectedCalendar_unwatch_idx" ON "SelectedCalendar"("integration", "googleChannelExpiration", "error", "unwatchAttempts", "maxAttempts");
|
||||
@@ -831,6 +831,10 @@ model SelectedCalendar {
|
||||
domainWideDelegationCredential DomainWideDelegation? @relation(fields: [domainWideDelegationCredentialId], references: [id], onDelete: Cascade)
|
||||
domainWideDelegationCredentialId String?
|
||||
error String?
|
||||
lastErrorAt DateTime?
|
||||
watchAttempts Int @default(0)
|
||||
unwatchAttempts Int @default(0)
|
||||
maxAttempts Int @default(3)
|
||||
|
||||
eventTypeId Int?
|
||||
eventType EventType? @relation(fields: [eventTypeId], references: [id])
|
||||
@@ -841,10 +845,12 @@ model SelectedCalendar {
|
||||
@@unique([userId, integration, externalId, eventTypeId])
|
||||
@@unique([googleChannelId, eventTypeId])
|
||||
@@index([userId])
|
||||
@@index([integration])
|
||||
@@index([externalId])
|
||||
@@index([eventTypeId])
|
||||
@@index([credentialId])
|
||||
// Composite indices to optimize calendar-cache queries
|
||||
@@index([integration, googleChannelExpiration, error, watchAttempts, maxAttempts], name: "SelectedCalendar_watch_idx")
|
||||
@@index([integration, googleChannelExpiration, error, unwatchAttempts, maxAttempts], name: "SelectedCalendar_unwatch_idx")
|
||||
}
|
||||
|
||||
enum EventTypeCustomInputType {
|
||||
|
||||
Reference in new issue
Block a user