aboutsummaryrefslogtreecommitdiffstats
path: root/packages/queue/schema.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/queue/schema.ts')
-rw-r--r--packages/queue/schema.ts36
1 files changed, 0 insertions, 36 deletions
diff --git a/packages/queue/schema.ts b/packages/queue/schema.ts
deleted file mode 100644
index 377c6b1c..00000000
--- a/packages/queue/schema.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
-
-function createdAtField() {
- return integer("createdAt", { mode: "timestamp" })
- .notNull()
- .$defaultFn(() => new Date());
-}
-
-export const tasksTable = sqliteTable(
- "tasks",
- {
- id: integer("id").notNull().primaryKey({ autoIncrement: true }),
- queue: text("queue").notNull(),
- payload: text("payload").notNull(),
- createdAt: createdAtField(),
- status: text("status", {
- enum: ["pending", "running", "pending_retry", "failed"],
- })
- .notNull()
- .default("pending"),
- expireAt: integer("expireAt", { mode: "timestamp" }),
- allocationId: text("allocationId").notNull(),
- numRunsLeft: integer("numRunsLeft").notNull(),
- maxNumRuns: integer("maxNumRuns").notNull(),
- },
- (tasks) => ({
- queueIdx: index("tasks_queue_idx").on(tasks.queue),
- statusIdx: index("tasks_status_idx").on(tasks.status),
- expireAtIdx: index("tasks_expire_at_idx").on(tasks.expireAt),
- numRunsLeftIdx: index("tasks_num_runs_left_idx").on(tasks.numRunsLeft),
- maxNumRunsIdx: index("tasks_max_num_runs_idx").on(tasks.maxNumRuns),
- allocationIdIdx: index("tasks_allocation_id_idx").on(tasks.allocationId),
- }),
-);
-
-export type Job = typeof tasksTable.$inferSelect;