Skip to content

Commit

Permalink
feat: add internal flag to job-run table (#563)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
hmacr and ericallam authored Oct 6, 2023
1 parent 65ad98c commit 1c524c5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/webapp/app/services/runs/createRun.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class CreateRunService {
? eventRecord.externalAccountId
: undefined,
isTest: eventRecord.isTest,
internal: job.internal,
},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- AlterTable
ALTER TABLE "JobRun" ADD COLUMN "internal" BOOLEAN NOT NULL DEFAULT false;

/*
Backfill JobRun internal flag
*/
UPDATE "JobRun"
SET "internal" = "Job"."internal"
FROM "Job"
WHERE "JobRun"."jobId" = "Job"."id" AND "JobRun"."internal" = TRUE;
1 change: 1 addition & 0 deletions packages/database/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ model EventRecord {
model JobRun {
id String @id @default(cuid())
number Int
internal Boolean @default(false)
job Job @relation(fields: [jobId], references: [id], onDelete: Cascade, onUpdate: Cascade)
jobId String
Expand Down

0 comments on commit 1c524c5

Please sign in to comment.