Skip to content

Commit d9aea07

Browse files
committed
Add Waitpoint resolver
1 parent 78f534e commit d9aea07

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-- CreateEnum
2+
CREATE TYPE "WaitpointResolver" AS ENUM ('ENGINE', 'TOKEN', 'HTTP_CALLBACK');
3+
4+
-- AlterTable
5+
ALTER TABLE "Waitpoint"
6+
ADD COLUMN "resolver" "WaitpointResolver" NOT NULL DEFAULT 'ENGINE';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- CreateIndex
2+
CREATE INDEX CONCURRENTLY IF NOT EXISTS "Waitpoint_environmentId_resolver_createdAt_idx" ON "Waitpoint" ("environmentId", "resolver", "createdAt" DESC);

internal-packages/database/prisma/schema.prisma

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2100,6 +2100,9 @@ model Waitpoint {
21002100
type WaitpointType
21012101
status WaitpointStatus @default(PENDING)
21022102
2103+
/// This is what will resolve the waitpoint, used to filter waitpoints in the dashboard
2104+
resolver WaitpointResolver @default(ENGINE)
2105+
21032106
completedAt DateTime?
21042107
21052108
/// If it's an Event type waitpoint, this is the event. It can also be provided for the DATETIME type
@@ -2150,7 +2153,7 @@ model Waitpoint {
21502153
createdAt DateTime @default(now())
21512154
updatedAt DateTime @updatedAt
21522155
2153-
/// Denormized column that holds the raw tags
2156+
/// Denormalized column that holds the raw tags
21542157
tags String[]
21552158
21562159
/// Quickly find an idempotent waitpoint
@@ -2162,6 +2165,8 @@ model Waitpoint {
21622165
@@index([environmentId, type, createdAt(sort: Desc)])
21632166
/// Status filtering
21642167
@@index([environmentId, type, status])
2168+
/// Dashboard filtering
2169+
@@index([environmentId, resolver, createdAt(sort: Desc)])
21652170
}
21662171

21672172
enum WaitpointType {
@@ -2176,6 +2181,15 @@ enum WaitpointStatus {
21762181
COMPLETED
21772182
}
21782183

2184+
enum WaitpointResolver {
2185+
/// The engine itself will resolve the waitpoint
2186+
ENGINE
2187+
/// A token will resolve the waitpoint, i.e. the user completes a token
2188+
TOKEN
2189+
/// A HTTP callback will resolve the waitpoint, i.e. the user uses our waitForHttpCallback function
2190+
HTTP_CALLBACK
2191+
}
2192+
21792193
model TaskRunWaitpoint {
21802194
id String @id @default(cuid())
21812195

0 commit comments

Comments
 (0)