Skip to content

Commit 717f4a4

Browse files
committed
Round 6
1 parent 359076d commit 717f4a4

File tree

2 files changed

+26
-168
lines changed

2 files changed

+26
-168
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the `DynamicTrigger` table. If the table is not empty, all the data it contains will be lost.
5+
- You are about to drop the `EventDispatcher` table. If the table is not empty, all the data it contains will be lost.
6+
- You are about to drop the `EventRecord` table. If the table is not empty, all the data it contains will be lost.
7+
- You are about to drop the `JobRun` table. If the table is not empty, all the data it contains will be lost.
8+
- You are about to drop the `_DynamicTriggerToJob` table. If the table is not empty, all the data it contains will be lost.
9+
10+
*/
11+
-- DropTable
12+
DROP TABLE IF EXISTS "DynamicTrigger" CASCADE;
13+
14+
-- DropTable
15+
DROP TABLE IF EXISTS "EventDispatcher" CASCADE;
16+
17+
-- DropTable
18+
DROP TABLE IF EXISTS "EventRecord" CASCADE;
19+
20+
-- DropTable
21+
DROP TABLE IF EXISTS "JobRun" CASCADE;
22+
23+
-- DropTable
24+
DROP TABLE IF EXISTS "_DynamicTriggerToJob" CASCADE;

internal-packages/database/prisma/schema.prisma

Lines changed: 2 additions & 168 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ model Organization {
145145
endpoints Endpoint[]
146146
jobs Job[]
147147
jobVersions JobVersion[]
148-
events EventRecord[]
149-
jobRuns JobRun[]
150148
151149
apiRateLimiterConfig Json?
152150
realtimeRateLimiterConfig Json?
@@ -176,10 +174,6 @@ model ExternalAccount {
176174
createdAt DateTime @default(now())
177175
updatedAt DateTime @updatedAt
178176
179-
events EventRecord[]
180-
runs JobRun[]
181-
EventDispatcher EventDispatcher[]
182-
183177
@@unique([environmentId, identifier])
184178
}
185179

@@ -344,10 +338,7 @@ model RuntimeEnvironment {
344338
345339
endpoints Endpoint[]
346340
jobVersions JobVersion[]
347-
events EventRecord[]
348-
jobRuns JobRun[]
349341
JobQueue JobQueue[]
350-
eventDispatchers EventDispatcher[]
351342
ExternalAccount ExternalAccount[]
352343
concurrencyLimitGroups ConcurrencyLimitGroup[]
353344
backgroundWorkers BackgroundWorker[]
@@ -414,8 +405,6 @@ model Project {
414405
endpoints Endpoint[]
415406
jobs Job[]
416407
jobVersion JobVersion[]
417-
events EventRecord[]
418-
runs JobRun[]
419408
httpEndpoints TriggerHttpEndpoint[]
420409
backgroundWorkers BackgroundWorker[]
421410
backgroundWorkerTasks BackgroundWorkerTask[]
@@ -471,9 +460,7 @@ model Endpoint {
471460
beforeCompleteTaskThreshold Int @default(750)
472461
afterCompleteTaskThreshold Int @default(750)
473462
474-
jobVersions JobVersion[]
475-
jobRuns JobRun[]
476-
dynamictriggers DynamicTrigger[]
463+
jobVersions JobVersion[]
477464
478465
@@unique([environmentId, slug])
479466
}
@@ -490,9 +477,7 @@ model Job {
490477
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade, onUpdate: Cascade)
491478
projectId String
492479
493-
versions JobVersion[]
494-
runs JobRun[]
495-
dynamicTriggers DynamicTrigger[]
480+
versions JobVersion[]
496481
497482
createdAt DateTime @default(now())
498483
updatedAt DateTime @default(now()) @updatedAt
@@ -539,9 +524,6 @@ model JobVersion {
539524
createdAt DateTime @default(now())
540525
updatedAt DateTime @updatedAt
541526
542-
runs JobRun[]
543-
dynamicTriggers DynamicTrigger[]
544-
545527
status JobVersionStatus @default(ACTIVE)
546528
547529
@@unique([jobId, version, environmentId])
@@ -582,172 +564,26 @@ model JobQueue {
582564
jobCount Int @default(0)
583565
maxJobs Int @default(100)
584566
585-
runs JobRun[]
586567
jobVersion JobVersion[]
587568
588569
@@unique([environmentId, name])
589570
}
590571

591-
model DynamicTrigger {
592-
id String @id @default(cuid())
593-
type DynamicTriggerType @default(EVENT)
594-
slug String
595-
596-
endpoint Endpoint @relation(fields: [endpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
597-
endpointId String
598-
599-
jobs Job[]
600-
601-
sourceRegistrationJob JobVersion? @relation(fields: [sourceRegistrationJobId], references: [id], onDelete: Cascade, onUpdate: Cascade)
602-
sourceRegistrationJobId String?
603-
604-
@@unique([endpointId, slug, type])
605-
}
606-
607572
enum DynamicTriggerType {
608573
EVENT
609574
SCHEDULE
610575
}
611576

612-
model EventDispatcher {
613-
id String @id @default(cuid())
614-
event String[]
615-
source String
616-
payloadFilter Json?
617-
contextFilter Json?
618-
manual Boolean @default(false)
619-
620-
dispatchableId String
621-
dispatchable Json
622-
623-
createdAt DateTime @default(now())
624-
updatedAt DateTime @updatedAt
625-
626-
enabled Boolean @default(true)
627-
628-
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
629-
environmentId String
630-
631-
externalAccount ExternalAccount? @relation(fields: [externalAccountId], references: [id], onDelete: Cascade, onUpdate: Cascade)
632-
externalAccountId String?
633-
634-
@@unique([dispatchableId, environmentId])
635-
}
636-
637577
enum JobStartPosition {
638578
INITIAL
639579
LATEST
640580
}
641581

642-
model EventRecord {
643-
id String @id @default(cuid())
644-
eventId String
645-
name String
646-
timestamp DateTime @default(now())
647-
payload Json
648-
payloadType PayloadType @default(JSON)
649-
context Json?
650-
sourceContext Json?
651-
652-
source String @default("trigger.dev")
653-
654-
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade, onUpdate: Cascade)
655-
organizationId String
656-
657-
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
658-
environmentId String
659-
660-
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade, onUpdate: Cascade)
661-
projectId String
662-
663-
externalAccount ExternalAccount? @relation(fields: [externalAccountId], references: [id], onDelete: Cascade, onUpdate: Cascade)
664-
externalAccountId String?
665-
666-
httpEndpoint TriggerHttpEndpoint? @relation(fields: [httpEndpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
667-
httpEndpointId String?
668-
669-
deliverAt DateTime @default(now())
670-
deliveredAt DateTime?
671-
672-
createdAt DateTime @default(now())
673-
updatedAt DateTime @updatedAt
674-
cancelledAt DateTime?
675-
676-
isTest Boolean @default(false)
677-
internal Boolean @default(false)
678-
runs JobRun[]
679-
680-
@@unique([eventId, environmentId])
681-
}
682-
683582
enum PayloadType {
684583
JSON
685584
REQUEST
686585
}
687586

688-
model JobRun {
689-
id String @id @default(cuid())
690-
number Int?
691-
internal Boolean @default(false)
692-
693-
job Job @relation(fields: [jobId], references: [id], onDelete: Cascade, onUpdate: Cascade)
694-
jobId String
695-
696-
version JobVersion @relation(fields: [versionId], references: [id], onDelete: Cascade, onUpdate: Cascade)
697-
versionId String
698-
699-
event EventRecord @relation(fields: [eventId], references: [id], onDelete: Cascade, onUpdate: Cascade)
700-
eventId String
701-
702-
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade, onUpdate: Cascade)
703-
organizationId String
704-
705-
endpoint Endpoint @relation(fields: [endpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
706-
endpointId String
707-
708-
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
709-
environmentId String
710-
711-
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade, onUpdate: Cascade)
712-
projectId String
713-
714-
queue JobQueue? @relation(fields: [queueId], references: [id])
715-
queueId String?
716-
717-
externalAccount ExternalAccount? @relation(fields: [externalAccountId], references: [id], onDelete: Cascade, onUpdate: Cascade)
718-
externalAccountId String?
719-
720-
createdAt DateTime @default(now())
721-
updatedAt DateTime @updatedAt
722-
queuedAt DateTime?
723-
startedAt DateTime?
724-
completedAt DateTime?
725-
726-
properties Json?
727-
728-
status JobRunStatus @default(PENDING)
729-
output Json?
730-
731-
timedOutAt DateTime?
732-
timedOutReason String?
733-
734-
executionCount Int @default(0)
735-
executionFailureCount Int @default(0)
736-
executionDuration Int @default(0)
737-
738-
isTest Boolean @default(false)
739-
preprocess Boolean @default(false)
740-
741-
yieldedExecutions String[]
742-
743-
forceYieldImmediately Boolean @default(false)
744-
745-
@@index([jobId, createdAt(sort: Desc)], map: "idx_jobrun_jobId_createdAt")
746-
@@index([organizationId, createdAt], map: "idx_jobrun_organizationId_createdAt")
747-
@@index([versionId], map: "idx_jobrun_versionId")
748-
@@index([eventId], map: "JobRun_eventId_idx")
749-
}
750-
751587
enum JobRunStatus {
752588
PENDING
753589
QUEUED
@@ -846,8 +682,6 @@ model TriggerHttpEndpoint {
846682
createdAt DateTime @default(now())
847683
updatedAt DateTime @updatedAt
848684
849-
eventRecords EventRecord[]
850-
851685
@@unique([key, projectId])
852686
}
853687

0 commit comments

Comments
 (0)