diff --git a/prisma/migrations/20260522000000_skip_attempt_count_and_channel_access/migration.sql b/prisma/migrations/20260522000000_skip_attempt_count_and_channel_access/migration.sql new file mode 100644 index 0000000..44e9bf9 --- /dev/null +++ b/prisma/migrations/20260522000000_skip_attempt_count_and_channel_access/migration.sql @@ -0,0 +1,8 @@ +-- AlterTable: track how many times the worker has tried each skipped source message. +-- Existing rows default to 1 (they represent a single past attempt that the worker +-- chose to record). Future failures increment via upsertSkippedPackage. +ALTER TABLE "skipped_packages" ADD COLUMN "attemptCount" INTEGER NOT NULL DEFAULT 1; + +-- AlterEnum: add CHANNEL_ACCESS_LOST so the worker can surface a notification +-- when a source channel becomes inaccessible (account removed, channel deleted, etc.) +ALTER TYPE "NotificationType" ADD VALUE 'CHANNEL_ACCESS_LOST'; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index c9646d1..9fd2eca 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -741,6 +741,12 @@ model SkippedPackage { sourceTopicId BigInt? isMultipart Boolean @default(false) partCount Int @default(1) + /// How many times the worker has tried to process this source message. + /// The worker auto-retries failures across cycles up to a configurable cap + /// (WORKER_MAX_SKIP_ATTEMPTS, default 5). After the cap, the watermark is + /// allowed to advance past the failure so cycles aren't pinned forever; + /// the user can manually retry via the UI to reset and try again. + attemptCount Int @default(1) accountId String account TelegramAccount @relation(fields: [accountId], references: [id], onDelete: Cascade) createdAt DateTime @default(now()) @@ -830,6 +836,7 @@ enum NotificationType { DOWNLOAD_FAILED GROUPING_CONFLICT INTEGRITY_AUDIT + CHANNEL_ACCESS_LOST } enum NotificationSeverity {