Skip to content

Commit cf1400c

Browse files
committed
Round 6
1 parent 1f5f6c4 commit cf1400c

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

@@ -360,10 +354,7 @@ model RuntimeEnvironment {
360354
361355
endpoints Endpoint[]
362356
jobVersions JobVersion[]
363-
events EventRecord[]
364-
jobRuns JobRun[]
365357
JobQueue JobQueue[]
366-
eventDispatchers EventDispatcher[]
367358
ExternalAccount ExternalAccount[]
368359
concurrencyLimitGroups ConcurrencyLimitGroup[]
369360
backgroundWorkers BackgroundWorker[]
@@ -432,8 +423,6 @@ model Project {
432423
endpoints Endpoint[]
433424
jobs Job[]
434425
jobVersion JobVersion[]
435-
events EventRecord[]
436-
runs JobRun[]
437426
httpEndpoints TriggerHttpEndpoint[]
438427
backgroundWorkers BackgroundWorker[]
439428
backgroundWorkerTasks BackgroundWorkerTask[]
@@ -489,9 +478,7 @@ model Endpoint {
489478
beforeCompleteTaskThreshold Int @default(750)
490479
afterCompleteTaskThreshold Int @default(750)
491480
492-
jobVersions JobVersion[]
493-
jobRuns JobRun[]
494-
dynamictriggers DynamicTrigger[]
481+
jobVersions JobVersion[]
495482
496483
@@unique([environmentId, slug])
497484
}
@@ -508,9 +495,7 @@ model Job {
508495
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade, onUpdate: Cascade)
509496
projectId String
510497
511-
versions JobVersion[]
512-
runs JobRun[]
513-
dynamicTriggers DynamicTrigger[]
498+
versions JobVersion[]
514499
515500
createdAt DateTime @default(now())
516501
updatedAt DateTime @default(now()) @updatedAt
@@ -557,9 +542,6 @@ model JobVersion {
557542
createdAt DateTime @default(now())
558543
updatedAt DateTime @updatedAt
559544
560-
runs JobRun[]
561-
dynamicTriggers DynamicTrigger[]
562-
563545
status JobVersionStatus @default(ACTIVE)
564546
565547
@@unique([jobId, version, environmentId])
@@ -600,172 +582,26 @@ model JobQueue {
600582
jobCount Int @default(0)
601583
maxJobs Int @default(100)
602584
603-
runs JobRun[]
604585
jobVersion JobVersion[]
605586
606587
@@unique([environmentId, name])
607588
}
608589

609-
model DynamicTrigger {
610-
id String @id @default(cuid())
611-
type DynamicTriggerType @default(EVENT)
612-
slug String
613-
614-
endpoint Endpoint @relation(fields: [endpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
615-
endpointId String
616-
617-
jobs Job[]
618-
619-
sourceRegistrationJob JobVersion? @relation(fields: [sourceRegistrationJobId], references: [id], onDelete: Cascade, onUpdate: Cascade)
620-
sourceRegistrationJobId String?
621-
622-
@@unique([endpointId, slug, type])
623-
}
624-
625590
enum DynamicTriggerType {
626591
EVENT
627592
SCHEDULE
628593
}
629594

630-
model EventDispatcher {
631-
id String @id @default(cuid())
632-
event String[]
633-
source String
634-
payloadFilter Json?
635-
contextFilter Json?
636-
manual Boolean @default(false)
637-
638-
dispatchableId String
639-
dispatchable Json
640-
641-
createdAt DateTime @default(now())
642-
updatedAt DateTime @updatedAt
643-
644-
enabled Boolean @default(true)
645-
646-
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
647-
environmentId String
648-
649-
externalAccount ExternalAccount? @relation(fields: [externalAccountId], references: [id], onDelete: Cascade, onUpdate: Cascade)
650-
externalAccountId String?
651-
652-
@@unique([dispatchableId, environmentId])
653-
}
654-
655595
enum JobStartPosition {
656596
INITIAL
657597
LATEST
658598
}
659599

660-
model EventRecord {
661-
id String @id @default(cuid())
662-
eventId String
663-
name String
664-
timestamp DateTime @default(now())
665-
payload Json
666-
payloadType PayloadType @default(JSON)
667-
context Json?
668-
sourceContext Json?
669-
670-
source String @default("trigger.dev")
671-
672-
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade, onUpdate: Cascade)
673-
organizationId String
674-
675-
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
676-
environmentId String
677-
678-
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade, onUpdate: Cascade)
679-
projectId String
680-
681-
externalAccount ExternalAccount? @relation(fields: [externalAccountId], references: [id], onDelete: Cascade, onUpdate: Cascade)
682-
externalAccountId String?
683-
684-
httpEndpoint TriggerHttpEndpoint? @relation(fields: [httpEndpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
685-
httpEndpointId String?
686-
687-
deliverAt DateTime @default(now())
688-
deliveredAt DateTime?
689-
690-
createdAt DateTime @default(now())
691-
updatedAt DateTime @updatedAt
692-
cancelledAt DateTime?
693-
694-
isTest Boolean @default(false)
695-
internal Boolean @default(false)
696-
runs JobRun[]
697-
698-
@@unique([eventId, environmentId])
699-
}
700-
701600
enum PayloadType {
702601
JSON
703602
REQUEST
704603
}
705604

706-
model JobRun {
707-
id String @id @default(cuid())
708-
number Int?
709-
internal Boolean @default(false)
710-
711-
job Job @relation(fields: [jobId], references: [id], onDelete: Cascade, onUpdate: Cascade)
712-
jobId String
713-
714-
version JobVersion @relation(fields: [versionId], references: [id], onDelete: Cascade, onUpdate: Cascade)
715-
versionId String
716-
717-
event EventRecord @relation(fields: [eventId], references: [id], onDelete: Cascade, onUpdate: Cascade)
718-
eventId String
719-
720-
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade, onUpdate: Cascade)
721-
organizationId String
722-
723-
endpoint Endpoint @relation(fields: [endpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
724-
endpointId String
725-
726-
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
727-
environmentId String
728-
729-
project Project @relation(fields: [projectId], references: [id], onDelete: Cascade, onUpdate: Cascade)
730-
projectId String
731-
732-
queue JobQueue? @relation(fields: [queueId], references: [id])
733-
queueId String?
734-
735-
externalAccount ExternalAccount? @relation(fields: [externalAccountId], references: [id], onDelete: Cascade, onUpdate: Cascade)
736-
externalAccountId String?
737-
738-
createdAt DateTime @default(now())
739-
updatedAt DateTime @updatedAt
740-
queuedAt DateTime?
741-
startedAt DateTime?
742-
completedAt DateTime?
743-
744-
properties Json?
745-
746-
status JobRunStatus @default(PENDING)
747-
output Json?
748-
749-
timedOutAt DateTime?
750-
timedOutReason String?
751-
752-
executionCount Int @default(0)
753-
executionFailureCount Int @default(0)
754-
executionDuration Int @default(0)
755-
756-
isTest Boolean @default(false)
757-
preprocess Boolean @default(false)
758-
759-
yieldedExecutions String[]
760-
761-
forceYieldImmediately Boolean @default(false)
762-
763-
@@index([jobId, createdAt(sort: Desc)], map: "idx_jobrun_jobId_createdAt")
764-
@@index([organizationId, createdAt], map: "idx_jobrun_organizationId_createdAt")
765-
@@index([versionId], map: "idx_jobrun_versionId")
766-
@@index([eventId], map: "JobRun_eventId_idx")
767-
}
768-
769605
enum JobRunStatus {
770606
PENDING
771607
QUEUED
@@ -864,8 +700,6 @@ model TriggerHttpEndpoint {
864700
createdAt DateTime @default(now())
865701
updatedAt DateTime @updatedAt
866702
867-
eventRecords EventRecord[]
868-
869703
@@unique([key, projectId])
870704
}
871705

0 commit comments

Comments
 (0)