Skip to content

Commit f74ad6f

Browse files
committed
Round 2
1 parent 70fb8ec commit f74ad6f

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
@@ -405,11 +404,9 @@ model RuntimeEnvironment {
405404
JobQueue JobQueue[]
406405
sources TriggerSource[]
407406
eventDispatchers EventDispatcher[]
408-
scheduleSources ScheduleSource[]
409407
ExternalAccount ExternalAccount[]
410408
httpEndpointEnvironments TriggerHttpEndpointEnvironment[]
411409
concurrencyLimitGroups ConcurrencyLimitGroup[]
412-
webhookEnvironments WebhookEnvironment[]
413410
backgroundWorkers BackgroundWorker[]
414411
backgroundWorkerTasks BackgroundWorkerTask[]
415412
taskRuns TaskRun[]
@@ -540,7 +537,6 @@ model Endpoint {
540537
dynamictriggers DynamicTrigger[]
541538
sources TriggerSource[]
542539
httpEndpointEnvironments TriggerHttpEndpointEnvironment[]
543-
webhookEnvironments WebhookEnvironment[]
544540
545541
@@unique([environmentId, slug])
546542
}
@@ -687,9 +683,8 @@ model DynamicTrigger {
687683
endpoint Endpoint @relation(fields: [endpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
688684
endpointId String
689685
690-
jobs Job[]
691-
sources TriggerSource[]
692-
scheduleSources ScheduleSource[]
686+
jobs Job[]
687+
sources TriggerSource[]
693688
694689
sourceRegistrationJob JobVersion? @relation(fields: [sourceRegistrationJobId], references: [id], onDelete: Cascade, onUpdate: Cascade)
695690
sourceRegistrationJobId String?
@@ -721,8 +716,6 @@ model EventDispatcher {
721716
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
722717
environmentId String
723718
724-
scheduleSources ScheduleSource[]
725-
726719
externalAccount ExternalAccount? @relation(fields: [externalAccountId], references: [id], onDelete: Cascade, onUpdate: Cascade)
727720
externalAccountId String?
728721
@@ -842,7 +835,6 @@ model JobRun {
842835
843836
tasks Task[]
844837
runConnections RunConnection[]
845-
executions JobRunExecution[]
846838
847839
@@index([jobId, createdAt(sort: Desc)], map: "idx_jobrun_jobId_createdAt")
848840
@@index([organizationId, createdAt], map: "idx_jobrun_organizationId_createdAt")
@@ -868,34 +860,6 @@ enum JobRunStatus {
868860
INVALID_PAYLOAD
869861
}
870862

871-
model JobRunExecution {
872-
id String @id @default(cuid())
873-
874-
run JobRun @relation(fields: [runId], references: [id], onDelete: Cascade, onUpdate: Cascade)
875-
runId String
876-
877-
retryCount Int @default(0)
878-
retryLimit Int @default(0)
879-
retryDelayInMs Int @default(0)
880-
881-
createdAt DateTime @default(now())
882-
updatedAt DateTime @updatedAt
883-
startedAt DateTime?
884-
completedAt DateTime?
885-
886-
error String?
887-
888-
reason JobRunExecutionReason @default(EXECUTE_JOB)
889-
status JobRunExecutionStatus @default(PENDING)
890-
891-
resumeTask Task? @relation(fields: [resumeTaskId], references: [id], onDelete: SetNull, onUpdate: Cascade)
892-
resumeTaskId String?
893-
894-
graphileJobId String?
895-
896-
isRetry Boolean @default(false)
897-
}
898-
899863
enum JobRunExecutionReason {
900864
PREPROCESS
901865
EXECUTE_JOB
@@ -949,7 +913,6 @@ model Task {
949913
950914
children Task[] @relation("TaskParent")
951915
childExecutionMode TaskChildExecutionMode @default(SEQUENTIAL)
952-
executions JobRunExecution[]
953916
954917
@@unique([runId, idempotencyKey])
955918
@@index([parentId], map: "idx_task_parentId")
@@ -1067,8 +1030,6 @@ model Webhook {
10671030
key String
10681031
params Json?
10691032
1070-
webhookEnvironments WebhookEnvironment[]
1071-
10721033
httpEndpoint TriggerHttpEndpoint @relation(fields: [httpEndpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
10731034
httpEndpointId String @unique
10741035
@@ -1084,62 +1045,6 @@ model Webhook {
10841045
@@unique([key, projectId])
10851046
}
10861047

1087-
model WebhookEnvironment {
1088-
id String @id @default(cuid())
1089-
1090-
active Boolean @default(false)
1091-
1092-
config Json?
1093-
desiredConfig Json?
1094-
1095-
endpoint Endpoint @relation(fields: [endpointId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1096-
endpointId String
1097-
1098-
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1099-
environmentId String
1100-
1101-
webhook Webhook @relation(fields: [webhookId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1102-
webhookId String
1103-
1104-
createdAt DateTime @default(now())
1105-
updatedAt DateTime @updatedAt
1106-
1107-
@@unique([environmentId, webhookId])
1108-
}
1109-
1110-
model ScheduleSource {
1111-
id String @id @default(cuid())
1112-
1113-
key String
1114-
schedule Json
1115-
1116-
environment RuntimeEnvironment @relation(fields: [environmentId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1117-
environmentId String
1118-
1119-
dispatcher EventDispatcher @relation(fields: [dispatcherId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1120-
dispatcherId String
1121-
1122-
lastEventTimestamp DateTime?
1123-
nextEventTimestamp DateTime?
1124-
1125-
workerJobId String?
1126-
1127-
active Boolean @default(false)
1128-
1129-
metadata Json?
1130-
1131-
createdAt DateTime @default(now())
1132-
updatedAt DateTime @updatedAt
1133-
1134-
dynamicTrigger DynamicTrigger? @relation(fields: [dynamicTriggerId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1135-
dynamicTriggerId String?
1136-
1137-
externalAccount ExternalAccount? @relation(fields: [externalAccountId], references: [id], onDelete: Cascade, onUpdate: Cascade)
1138-
externalAccountId String?
1139-
1140-
@@unique([key, environmentId])
1141-
}
1142-
11431048
model TriggerHttpEndpoint {
11441049
id String @id @default(cuid())
11451050

0 commit comments

Comments
 (0)