Skip to content

Commit 1c524c5

Browse files
hmacrericallam
andauthored
feat: add internal flag to job-run table (#563)
* feat: add internal flag to job-run table * add backfill SQL * Update internal backfill to only update internal jobs --------- Co-authored-by: Eric Allam <[email protected]>
1 parent 65ad98c commit 1c524c5

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

apps/webapp/app/services/runs/createRun.server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ export class CreateRunService {
7070
? eventRecord.externalAccountId
7171
: undefined,
7272
isTest: eventRecord.isTest,
73+
internal: job.internal,
7374
},
7475
});
7576

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- AlterTable
2+
ALTER TABLE "JobRun" ADD COLUMN "internal" BOOLEAN NOT NULL DEFAULT false;
3+
4+
/*
5+
Backfill JobRun internal flag
6+
*/
7+
UPDATE "JobRun"
8+
SET "internal" = "Job"."internal"
9+
FROM "Job"
10+
WHERE "JobRun"."jobId" = "Job"."id" AND "JobRun"."internal" = TRUE;

packages/database/prisma/schema.prisma

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ model EventRecord {
666666
model JobRun {
667667
id String @id @default(cuid())
668668
number Int
669+
internal Boolean @default(false)
669670
670671
job Job @relation(fields: [jobId], references: [id], onDelete: Cascade, onUpdate: Cascade)
671672
jobId String

0 commit comments

Comments
 (0)