From 80d41ac78fa0f7512d2d242cd0255972955c30ae Mon Sep 17 00:00:00 2001 From: xCyanGrizzly Date: Fri, 31 Jul 2026 04:30:33 +0200 Subject: [PATCH] feat(db): add TelegramChannel.allowsForwarding + IngestionRun.zipsForwarded --- .../migration.sql | 10 ++++++++++ prisma/schema.prisma | 6 ++++++ 2 files changed, 16 insertions(+) create mode 100644 prisma/migrations/20260731000000_add_forward_priority_ingestion/migration.sql diff --git a/prisma/migrations/20260731000000_add_forward_priority_ingestion/migration.sql b/prisma/migrations/20260731000000_add_forward_priority_ingestion/migration.sql new file mode 100644 index 0000000..3e23fcc --- /dev/null +++ b/prisma/migrations/20260731000000_add_forward_priority_ingestion/migration.sql @@ -0,0 +1,10 @@ +-- AlterTable: forward-priority ingestion support. +-- allowsForwarding is nullable — null means "not yet checked", treated the +-- same as false until confirmed true (safe default: download+reupload path). +ALTER TABLE "telegram_channels" + ADD COLUMN "allowsForwarding" BOOLEAN; + +-- AlterTable: count of packages forwarded (no download) during a run. +-- Additive, non-null with a default of 0 — no data change for existing rows. +ALTER TABLE "ingestion_runs" + ADD COLUMN "zipsForwarded" INTEGER NOT NULL DEFAULT 0; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index c25b8ce..f1d1a7c 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -428,6 +428,11 @@ model TelegramChannel { isForum Boolean @default(false) isActive Boolean @default(false) category String? @db.VarChar(64) + /// Whether this chat currently allows forwarding/saving (the inverse of + /// TDLib's chat.has_protected_content). Null = not yet checked; treated the + /// same as false everywhere in the worker (safe default: use the + /// download+reupload path until this is confirmed true). + allowsForwarding Boolean? createdAt DateTime @default(now()) updatedAt DateTime @updatedAt @@ -570,6 +575,7 @@ model IngestionRun { zipsDuplicate Int @default(0) zipsIngested Int @default(0) zipsBackfilled Int @default(0) + zipsForwarded Int @default(0) errorMessage String? // Live activity tracking — written by worker in real-time