Skip to content

Commit 5301239

Browse files
chore: remove v2 models from schema (#2107)
* Round 1 of v2 model removals * Round 2 * Remove trigger http endpoint env * Round 3 * Round 4 * Round 5 * Round 6 * Round 7 * Round 8 * Round 9 * Round 10 * Removed the remainder v2 code from the webapp * GitButler WIP Commit --------- Co-authored-by: GitButler <gitbutler@gitbutler.com>
1 parent 261dce1 commit 5301239

File tree

15 files changed

+392
-1384
lines changed

15 files changed

+392
-1384
lines changed

apps/webapp/app/database-types.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type {
77
BatchTaskRunItemStatus as BatchTaskRunItemStatusType,
88
TaskRunAttemptStatus as TaskRunAttemptStatusType,
99
TaskRunStatus as TaskRunStatusType,
10-
JobRunStatus as JobRunStatusType,
1110
RuntimeEnvironmentType as RuntimeEnvironmentTypeType,
1211
} from "@trigger.dev/database";
1312

@@ -46,24 +45,6 @@ export const TaskRunStatus = {
4645
TIMED_OUT: "TIMED_OUT",
4746
} as const satisfies Record<TaskRunStatusType, TaskRunStatusType>;
4847

49-
export const JobRunStatus = {
50-
PENDING: "PENDING",
51-
QUEUED: "QUEUED",
52-
WAITING_ON_CONNECTIONS: "WAITING_ON_CONNECTIONS",
53-
PREPROCESSING: "PREPROCESSING",
54-
STARTED: "STARTED",
55-
EXECUTING: "EXECUTING",
56-
WAITING_TO_CONTINUE: "WAITING_TO_CONTINUE",
57-
WAITING_TO_EXECUTE: "WAITING_TO_EXECUTE",
58-
SUCCESS: "SUCCESS",
59-
FAILURE: "FAILURE",
60-
TIMED_OUT: "TIMED_OUT",
61-
ABORTED: "ABORTED",
62-
CANCELED: "CANCELED",
63-
UNRESOLVED_AUTH: "UNRESOLVED_AUTH",
64-
INVALID_PAYLOAD: "INVALID_PAYLOAD",
65-
} as const satisfies Record<JobRunStatusType, JobRunStatusType>;
66-
6748
export const RuntimeEnvironmentType = {
6849
PRODUCTION: "PRODUCTION",
6950
STAGING: "STAGING",

apps/webapp/app/services/platform.v3.server.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,6 @@ export async function getCurrentPlan(orgId: string) {
193193
firstDayOfNextMonth.setUTCMonth(firstDayOfNextMonth.getUTCMonth() + 1);
194194
firstDayOfNextMonth.setUTCHours(0, 0, 0, 0);
195195

196-
const currentRunCount = await $replica.jobRun.count({
197-
where: {
198-
organizationId: orgId,
199-
createdAt: {
200-
gte: firstDayOfMonth,
201-
},
202-
},
203-
});
204-
205196
if (!result.success) {
206197
logger.error("Error getting current plan", { orgId, error: result.error });
207198
return undefined;
@@ -212,11 +203,6 @@ export async function getCurrentPlan(orgId: string) {
212203
const periodRemainingDuration = periodEnd.getTime() - new Date().getTime();
213204

214205
const usage = {
215-
currentRunCount,
216-
runCountCap: result.subscription?.plan.runs?.freeAllowance,
217-
exceededRunCount: result.subscription?.plan.runs?.freeAllowance
218-
? currentRunCount > result.subscription?.plan.runs?.freeAllowance
219-
: false,
220206
periodStart,
221207
periodEnd,
222208
periodRemainingDuration,

apps/webapp/app/services/telemetry.server.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Job } from "@trigger.dev/database";
21
import { PostHog } from "posthog-node";
32
import { env } from "~/env.server";
43
import { MatchedOrganization } from "~/hooks/useOrganizations";
@@ -145,7 +144,6 @@ class Telemetry {
145144
},
146145
});
147146
},
148-
deletedJob: ({ job }: { job: Job }) => {},
149147
};
150148

151149
#capture(event: CaptureEvent) {
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the `JobCounter` table. If the table is not empty, all the data it contains will be lost.
5+
- You are about to drop the `WebhookDeliveryCounter` table. If the table is not empty, all the data it contains will be lost.
6+
- You are about to drop the `ApiIntegrationVote` table. If the table is not empty, all the data it contains will be lost.
7+
- You are about to drop the `ConnectionAttempt` table. If the table is not empty, all the data it contains will be lost.
8+
- You are about to drop the `DeferredScheduledEventService` table. If the table is not empty, all the data it contains will be lost.
9+
- You are about to drop the `DynamicTriggerRegistration` table. If the table is not empty, all the data it contains will be lost.
10+
- You are about to drop the `EndpointIndex` table. If the table is not empty, all the data it contains will be lost.
11+
- You are about to drop the `EventExample` table. If the table is not empty, all the data it contains will be lost.
12+
- You are about to drop the `HttpSourceRequestDelivery` table. If the table is not empty, all the data it contains will be lost.
13+
- You are about to drop the `JobAlias` table. If the table is not empty, all the data it contains will be lost.
14+
- You are about to drop the `JobIntegration` table. If the table is not empty, all the data it contains will be lost.
15+
- You are about to drop the `JobRunAutoYieldExecution` table. If the table is not empty, all the data it contains will be lost.
16+
- You are about to drop the `JobRunStatusRecord` table. If the table is not empty, all the data it contains will be lost.
17+
- You are about to drop the `JobRunSubscription` table. If the table is not empty, all the data it contains will be lost.
18+
- You are about to drop the `KeyValueItem` table. If the table is not empty, all the data it contains will be lost.
19+
- You are about to drop the `MissingConnection` table. If the table is not empty, all the data it contains will be lost.
20+
- You are about to drop the `TaskAttempt` table. If the table is not empty, all the data it contains will be lost.
21+
- You are about to drop the `TriggerSourceOption` table. If the table is not empty, all the data it contains will be lost.
22+
- You are about to drop the `WebhookRequestDelivery` table. If the table is not empty, all the data it contains will be lost.
23+
- You are about to drop the `_JobRunToMissingConnection` table. If the table is not empty, all the data it contains will be lost.
24+
25+
*/
26+
27+
-- DropTable
28+
DROP TABLE IF EXISTS "JobCounter";
29+
30+
-- DropTable
31+
DROP TABLE IF EXISTS "WebhookDeliveryCounter";
32+
33+
-- DropTable
34+
DROP TABLE IF EXISTS "ApiIntegrationVote";
35+
36+
-- DropTable
37+
DROP TABLE IF EXISTS "ConnectionAttempt";
38+
39+
-- DropTable
40+
DROP TABLE IF EXISTS "DeferredScheduledEventService";
41+
42+
-- DropTable
43+
DROP TABLE IF EXISTS "DynamicTriggerRegistration";
44+
45+
-- DropTable
46+
DROP TABLE IF EXISTS "EndpointIndex";
47+
48+
-- DropTable
49+
DROP TABLE IF EXISTS "EventExample";
50+
51+
-- DropTable
52+
DROP TABLE IF EXISTS "HttpSourceRequestDelivery";
53+
54+
-- DropTable
55+
DROP TABLE IF EXISTS "JobAlias";
56+
57+
-- DropTable
58+
DROP TABLE IF EXISTS "JobIntegration";
59+
60+
-- DropTable
61+
DROP TABLE IF EXISTS "JobRunAutoYieldExecution";
62+
63+
-- DropTable
64+
DROP TABLE IF EXISTS "JobRunStatusRecord";
65+
66+
-- DropTable
67+
DROP TABLE IF EXISTS "JobRunSubscription";
68+
69+
-- DropTable
70+
DROP TABLE IF EXISTS "KeyValueItem";
71+
72+
-- DropTable
73+
DROP TABLE IF EXISTS "MissingConnection" CASCADE;
74+
75+
-- DropTable
76+
DROP TABLE IF EXISTS "TaskAttempt";
77+
78+
-- DropTable
79+
DROP TABLE IF EXISTS "TriggerSourceOption";
80+
81+
-- DropTable
82+
DROP TABLE IF EXISTS "WebhookRequestDelivery";
83+
84+
-- DropTable
85+
DROP TABLE IF EXISTS "_JobRunToMissingConnection";
86+
87+
-- DropEnum
88+
DROP TYPE IF EXISTS "EndpointIndexSource";
89+
90+
-- DropEnum
91+
DROP TYPE IF EXISTS "EndpointIndexStatus";
92+
93+
-- DropEnum
94+
DROP TYPE IF EXISTS "JobRunSubscriptionEvents";
95+
96+
-- DropEnum
97+
DROP TYPE IF EXISTS "JobRunSubscriptionRecipientMethod";
98+
99+
-- DropEnum
100+
DROP TYPE IF EXISTS "JobRunSubscriptionStatus";
101+
102+
-- DropEnum
103+
DROP TYPE IF EXISTS "TaskAttemptStatus";
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;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the column `httpEndpointEnvironmentId` on the `EventRecord` table. All the data in the column will be lost.
5+
- You are about to drop the `TriggerHttpEndpointEnvironment` table. If the table is not empty, all the data it contains will be lost.
6+
7+
*/
8+
-- AlterTable
9+
ALTER TABLE "EventRecord" DROP COLUMN IF EXISTS "httpEndpointEnvironmentId" CASCADE;
10+
11+
-- DropTable
12+
DROP TABLE IF EXISTS "TriggerHttpEndpointEnvironment" CASCADE;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the `Task` table. If the table is not empty, all the data it contains will be lost.
5+
- You are about to drop the `Webhook` table. If the table is not empty, all the data it contains will be lost.
6+
7+
*/
8+
-- DropTable
9+
DROP TABLE IF EXISTS "Task" CASCADE;
10+
11+
-- DropTable
12+
DROP TABLE IF EXISTS "Webhook" CASCADE;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the `RunConnection` table. If the table is not empty, all the data it contains will be lost.
5+
- You are about to drop the `TriggerSource` table. If the table is not empty, all the data it contains will be lost.
6+
7+
*/
8+
9+
-- DropTable
10+
DROP TABLE IF EXISTS "RunConnection" CASCADE;
11+
12+
-- DropTable
13+
DROP TABLE IF EXISTS "TriggerSource" CASCADE;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the `IntegrationConnection` table. If the table is not empty, all the data it contains will be lost.
5+
6+
*/
7+
-- DropTable
8+
DROP TABLE IF EXISTS "IntegrationConnection" CASCADE;
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;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the `JobVersion` table. If the table is not empty, all the data it contains will be lost.
5+
- You are about to drop the `TriggerHttpEndpoint` table. If the table is not empty, all the data it contains will be lost.
6+
7+
*/
8+
-- DropTable
9+
DROP TABLE IF EXISTS "JobVersion" CASCADE;
10+
11+
-- DropTable
12+
DROP TABLE IF EXISTS "TriggerHttpEndpoint" CASCADE;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the `ConcurrencyLimitGroup` table. If the table is not empty, all the data it contains will be lost.
5+
- You are about to drop the `Endpoint` table. If the table is not empty, all the data it contains will be lost.
6+
- You are about to drop the `Job` table. If the table is not empty, all the data it contains will be lost.
7+
- You are about to drop the `JobQueue` table. If the table is not empty, all the data it contains will be lost.
8+
9+
*/
10+
-- DropTable
11+
DROP TABLE IF EXISTS "ConcurrencyLimitGroup" CASCADE;
12+
13+
-- DropTable
14+
DROP TABLE IF EXISTS "Endpoint" CASCADE;
15+
16+
-- DropTable
17+
DROP TABLE IF EXISTS "Job" CASCADE;
18+
19+
-- DropTable
20+
DROP TABLE IF EXISTS "JobQueue" CASCADE;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the `ExternalAccount` table. If the table is not empty, all the data it contains will be lost.
5+
- You are about to drop the `Integration` table. If the table is not empty, all the data it contains will be lost.
6+
- You are about to drop the `IntegrationAuthMethod` table. If the table is not empty, all the data it contains will be lost.
7+
- You are about to drop the `IntegrationDefinition` table. If the table is not empty, all the data it contains will be lost.
8+
9+
*/
10+
-- DropTable
11+
DROP TABLE IF EXISTS "ExternalAccount" CASCADE;
12+
13+
-- DropTable
14+
DROP TABLE IF EXISTS "Integration" CASCADE;
15+
16+
-- DropTable
17+
DROP TABLE IF EXISTS "IntegrationAuthMethod" CASCADE;
18+
19+
-- DropTable
20+
DROP TABLE IF EXISTS "IntegrationDefinition" CASCADE;
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
-- DropEnum
2+
DROP TYPE IF EXISTS "ConnectionType";
3+
4+
-- DropEnum
5+
DROP TYPE IF EXISTS "DynamicTriggerType";
6+
7+
-- DropEnum
8+
DROP TYPE IF EXISTS "IntegrationAuthSource";
9+
10+
-- DropEnum
11+
DROP TYPE IF EXISTS "IntegrationSetupStatus";
12+
13+
-- DropEnum
14+
DROP TYPE IF EXISTS "JobRunExecutionReason";
15+
16+
-- DropEnum
17+
DROP TYPE IF EXISTS "JobRunExecutionStatus";
18+
19+
-- DropEnum
20+
DROP TYPE IF EXISTS "JobRunStatus";
21+
22+
-- DropEnum
23+
DROP TYPE IF EXISTS "JobStartPosition";
24+
25+
-- DropEnum
26+
DROP TYPE IF EXISTS "JobVersionStatus";
27+
28+
-- DropEnum
29+
DROP TYPE IF EXISTS "PayloadType";
30+
31+
-- DropEnum
32+
DROP TYPE IF EXISTS "TaskChildExecutionMode";
33+
34+
-- DropEnum
35+
DROP TYPE IF EXISTS "TaskStatus";
36+
37+
-- DropEnum
38+
DROP TYPE IF EXISTS "TriggerChannel";

0 commit comments

Comments
 (0)