Skip to content

Commit 73c3636

Browse files
committed
feat(database): TaskQueue concurrencyVersion and role columns
concurrencyVersion records how a queue's concurrency was declared (V1 = legacy contextual concurrencyLimit, V2 = the explicit perKey/total shape) so display never has to guess what a stored number meant. role distinguishes real queues from the rows that back named concurrency limits, which every queue-facing surface filters out. Defaults cover all existing rows with no backfill.
1 parent e6e3e65 commit 73c3636

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- CreateEnum
2+
CREATE TYPE "TaskQueueConcurrencyVersion" AS ENUM ('V1', 'V2');
3+
4+
-- CreateEnum
5+
CREATE TYPE "TaskQueueRole" AS ENUM ('QUEUE', 'LIMIT');
6+
7+
-- AlterTable
8+
ALTER TABLE "TaskQueue" ADD COLUMN "concurrencyVersion" "TaskQueueConcurrencyVersion" NOT NULL DEFAULT 'V1',
9+
ADD COLUMN "role" "TaskQueueRole" NOT NULL DEFAULT 'QUEUE';

internal-packages/database/prisma/schema.prisma

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,6 +1963,13 @@ model TaskQueue {
19631963
version TaskQueueVersion @default(V1)
19641964
orderableName String?
19651965
1966+
/// How the queue's concurrency was declared: V1 = legacy concurrencyLimit semantics
1967+
/// (per key when keyed, whole queue otherwise), V2 = the explicit perKey/total shape.
1968+
concurrencyVersion TaskQueueConcurrencyVersion @default(V1)
1969+
/// QUEUE rows are real queues; LIMIT rows back named concurrency limits and are
1970+
/// excluded from every queue-facing surface.
1971+
role TaskQueueRole @default(QUEUE)
1972+
19661973
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade, onUpdate: Cascade)
19671974
projectId String
19681975
@@ -2016,6 +2023,16 @@ enum TaskQueueVersion {
20162023
V2
20172024
}
20182025

2026+
enum TaskQueueConcurrencyVersion {
2027+
V1
2028+
V2
2029+
}
2030+
2031+
enum TaskQueueRole {
2032+
QUEUE
2033+
LIMIT
2034+
}
2035+
20192036
model BatchTaskRun {
20202037
id String @id @default(cuid())
20212038
friendlyId String @unique

0 commit comments

Comments
 (0)