Skip to content

Commit 8a17249

Browse files
committed
Round 2
1 parent 8d40e65 commit 8a17249

File tree

3 files changed

+19
-98
lines changed

3 files changed

+19
-98
lines changed

internal-packages/database/prisma/migrations/20250526092407_remove_v2_tables_round_1/migration.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ DROP TABLE IF EXISTS "JobRunSubscription";
7070
DROP TABLE IF EXISTS "KeyValueItem";
7171

7272
-- DropTable
73-
DROP TABLE IF EXISTS "MissingConnection";
73+
DROP TABLE IF EXISTS "MissingConnection" CASCADE;
7474

7575
-- DropTable
7676
DROP TABLE IF EXISTS "TaskAttempt";
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the `JobRunExecution` table. If the table is not empty, all the data it contains will be lost.
5+
- You are about to drop the `ScheduleSource` table. If the table is not empty, all the data it contains will be lost.
6+
- You are about to drop the `WebhookEnvironment` table. If the table is not empty, all the data it contains will be lost.
7+
8+
*/
9+
-- DropTable
10+
DROP TABLE IF EXISTS "JobRunExecution" CASCADE;
11+
12+
-- DropTable
13+
DROP TABLE IF EXISTS "ScheduleSource" CASCADE;
14+
15+
-- DropTable
16+
DROP TABLE IF EXISTS "WebhookEnvironment" CASCADE;

internal-packages/database/prisma/schema.prisma

Lines changed: 2 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ model ExternalAccount {
181181
connections IntegrationConnection[]
182182
events EventRecord[]
183183
runs JobRun[]
184-
schedules ScheduleSource[]
185184
triggerSources TriggerSource[]
186185
EventDispatcher EventDispatcher[]
187186
@@ -389,11 +388,9 @@ model RuntimeEnvironment {
389388
JobQueue JobQueue[]
390389
sources TriggerSource[]
391390
eventDispatchers EventDispatcher[]
392-
scheduleSources ScheduleSource[]
393391
ExternalAccount ExternalAccount[]
394392
httpEndpointEnvironments TriggerHttpEndpointEnvironment[]
395393
concurrencyLimitGroups ConcurrencyLimitGroup[]
396-
webhookEnvironments WebhookEnvironment[]
397394
backgroundWorkers BackgroundWorker[]
398395
backgroundWorkerTasks BackgroundWorkerTask[]
399396
taskRuns TaskRun[]
@@ -522,7 +519,6 @@ model Endpoint {
522519
dynamictriggers DynamicTrigger[]
523520
sources TriggerSource[]
524521
httpEndpointEnvironments TriggerHttpEndpointEnvironment[]
525-
webhookEnvironments WebhookEnvironment[]
526522
527523
@@unique([environmentId, slug])
528524
}
@@ -669,9 +665,8 @@ model DynamicTrigger {
669665
endpoint Endpoint @relation(fields: [endpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
670666
endpointId String
671667
672-
jobs Job[]
673-
sources TriggerSource[]
674-
scheduleSources ScheduleSource[]
668+
jobs Job[]
669+
sources TriggerSource[]
675670
676671
sourceRegistrationJob JobVersion? @relation(fields: [sourceRegistrationJobId], references: [id], onDelete: Cascade, onUpdate: Cascade)
677672
sourceRegistrationJobId String?
@@ -703,8 +698,6 @@ model EventDispatcher {
703698
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
704699
environmentId String
705700
706-
scheduleSources ScheduleSource[]
707-
708701
externalAccount ExternalAccount? @relation(fields: [externalAccountId], references: [id], onDelete: Cascade, onUpdate: Cascade)
709702
externalAccountId String?
710703
@@ -824,7 +817,6 @@ model JobRun {
824817
825818
tasks Task[]
826819
runConnections RunConnection[]
827-
executions JobRunExecution[]
828820
829821
@@index([jobId, createdAt(sort: Desc)], map: "idx_jobrun_jobId_createdAt")
830822
@@index([organizationId, createdAt], map: "idx_jobrun_organizationId_createdAt")
@@ -850,34 +842,6 @@ enum JobRunStatus {
850842
INVALID_PAYLOAD
851843
}
852844

853-
model JobRunExecution {
854-
id String @id @default(cuid())
855-
856-
run JobRun @relation(fields: [runId], references: [id], onDelete: Cascade, onUpdate: Cascade)
857-
runId String
858-
859-
retryCount Int @default(0)
860-
retryLimit Int @default(0)
861-
retryDelayInMs Int @default(0)
862-
863-
createdAt DateTime @default(now())
864-
updatedAt DateTime @updatedAt
865-
startedAt DateTime?
866-
completedAt DateTime?
867-
868-
error String?
869-
870-
reason JobRunExecutionReason @default(EXECUTE_JOB)
871-
status JobRunExecutionStatus @default(PENDING)
872-
873-
resumeTask Task? @relation(fields: [resumeTaskId], references: [id], onDelete: SetNull, onUpdate: Cascade)
874-
resumeTaskId String?
875-
876-
graphileJobId String?
877-
878-
isRetry Boolean @default(false)
879-
}
880-
881845
enum JobRunExecutionReason {
882846
PREPROCESS
883847
EXECUTE_JOB
@@ -931,7 +895,6 @@ model Task {
931895
932896
children Task[] @relation("TaskParent")
933897
childExecutionMode TaskChildExecutionMode @default(SEQUENTIAL)
934-
executions JobRunExecution[]
935898
936899
@@unique([runId, idempotencyKey])
937900
@@index([parentId], map: "idx_task_parentId")
@@ -1049,8 +1012,6 @@ model Webhook {
10491012
key String
10501013
params Json?
10511014
1052-
webhookEnvironments WebhookEnvironment[]
1053-
10541015
httpEndpoint TriggerHttpEndpoint @relation(fields: [httpEndpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
10551016
httpEndpointId String @unique
10561017
@@ -1066,62 +1027,6 @@ model Webhook {
10661027
@@unique([key, projectId])
10671028
}
10681029

1069-
model WebhookEnvironment {
1070-
id String @id @default(cuid())
1071-
1072-
active Boolean @default(false)
1073-
1074-
config Json?
1075-
desiredConfig Json?
1076-
1077-
endpoint Endpoint @relation(fields: [endpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1078-
endpointId String
1079-
1080-
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1081-
environmentId String
1082-
1083-
webhook Webhook @relation(fields: [webhookId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1084-
webhookId String
1085-
1086-
createdAt DateTime @default(now())
1087-
updatedAt DateTime @updatedAt
1088-
1089-
@@unique([environmentId, webhookId])
1090-
}
1091-
1092-
model ScheduleSource {
1093-
id String @id @default(cuid())
1094-
1095-
key String
1096-
schedule Json
1097-
1098-
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1099-
environmentId String
1100-
1101-
dispatcher EventDispatcher @relation(fields: [dispatcherId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1102-
dispatcherId String
1103-
1104-
lastEventTimestamp DateTime?
1105-
nextEventTimestamp DateTime?
1106-
1107-
workerJobId String?
1108-
1109-
active Boolean @default(false)
1110-
1111-
metadata Json?
1112-
1113-
createdAt DateTime @default(now())
1114-
updatedAt DateTime @updatedAt
1115-
1116-
dynamicTrigger DynamicTrigger? @relation(fields: [dynamicTriggerId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1117-
dynamicTriggerId String?
1118-
1119-
externalAccount ExternalAccount? @relation(fields: [externalAccountId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1120-
externalAccountId String?
1121-
1122-
@@unique([key, environmentId])
1123-
}
1124-
11251030
model TriggerHttpEndpoint {
11261031
id String @id @default(cuid())
11271032

0 commit comments

Comments
 (0)