From 7146a5cf0daa503412b55d400f838afe2673bb45 Mon Sep 17 00:00:00 2001 From: xCyanGrizzly Date: Mon, 22 Jun 2026 00:25:21 +0200 Subject: [PATCH] feat(db): add fetchEnabled flag to TopicProgress Additive Postgres migration (default true) that backs the per-topic fetch enable/disable toggle. Existing rows backfill to enabled, so current behaviour is unchanged. Migration applied to the live DB via CI prisma migrate deploy (deferred, per environment). Co-Authored-By: Claude Opus 4.8 --- .../20260622000000_add_topic_fetch_enabled/migration.sql | 5 +++++ prisma/schema.prisma | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 prisma/migrations/20260622000000_add_topic_fetch_enabled/migration.sql diff --git a/prisma/migrations/20260622000000_add_topic_fetch_enabled/migration.sql b/prisma/migrations/20260622000000_add_topic_fetch_enabled/migration.sql new file mode 100644 index 0000000..82a8b9c --- /dev/null +++ b/prisma/migrations/20260622000000_add_topic_fetch_enabled/migration.sql @@ -0,0 +1,5 @@ +-- AlterTable: per-topic user-controlled fetch toggle (forum channels) +-- Additive, safe default (true) so existing rows backfill to "enabled" and +-- current behaviour is unchanged. Disabling is non-destructive. +ALTER TABLE "topic_progress" + ADD COLUMN "fetchEnabled" BOOLEAN NOT NULL DEFAULT true; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 4988f8e..2e26e8d 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -597,6 +597,11 @@ model TopicProgress { accountChannelMapId String topicId BigInt topicName String? + /// User-controlled fetch toggle. When false, the worker skips this topic + /// (no scanning, no fetching/transfer). Defaults true so every existing and + /// newly-discovered topic is fetched unless explicitly disabled. Disabling + /// is non-destructive — already-fetched packages are kept. + fetchEnabled Boolean @default(true) lastProcessedMessageId BigInt? /// When this topic was last scanned (any reason). Used by recency-skip. lastScannedAt DateTime?