Skip to content

Commit 603acad

Browse files
committed
feat(schema): add WorkerDeployment.externalId and task_runs_v2.external_deployment_id
Migrations only, no code reads them yet. Postgres: nullable non-unique externalId on WorkerDeployment plus a CONCURRENTLY-built (environmentId, externalId) index in its own migration file. ClickHouse: external_deployment_id String DEFAULT '' on task_runs_v2 (plain String, not LowCardinality - commit SHAs are high-cardinality). Part of task run version skew protection (TRI-12998).
1 parent cffaa05 commit 603acad

4 files changed

Lines changed: 11 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- +goose Up
2+
ALTER TABLE trigger_dev.task_runs_v2
3+
ADD COLUMN IF NOT EXISTS external_deployment_id String DEFAULT '';
4+
5+
-- +goose Down
6+
ALTER TABLE trigger_dev.task_runs_v2
7+
DROP COLUMN IF EXISTS external_deployment_id;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE "public"."WorkerDeployment" ADD COLUMN IF NOT EXISTS "externalId" TEXT;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE INDEX CONCURRENTLY IF NOT EXISTS "WorkerDeployment_environmentId_externalId_idx" ON "public"."WorkerDeployment"("environmentId", "externalId");

internal-packages/database/prisma/schema.prisma

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2288,6 +2288,7 @@ model WorkerDeployment {
22882288
triggeredById String?
22892289
triggeredVia String?
22902290
commitSHA String?
2291+
externalId String?
22912292
22922293
startedAt DateTime?
22932294
installedAt DateTime?
@@ -2316,6 +2317,7 @@ model WorkerDeployment {
23162317
@@index([commitSHA])
23172318
@@index([environmentId, createdAt])
23182319
@@index([environmentId, status, id])
2320+
@@index([environmentId, externalId])
23192321
}
23202322

23212323
enum WorkerDeploymentStatus {

0 commit comments

Comments
 (0)