Skip to content

Commit 2490723

Browse files
committed
update dependencies and migration scripts; remove obsolete migration files and add new schema for job management
1 parent 9df9ef8 commit 2490723

File tree

12 files changed

+2568
-2289
lines changed

12 files changed

+2568
-2289
lines changed

bun.lock

Lines changed: 167 additions & 329 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/docs/content/docs/getting-started.mdx

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,48 @@ Install Duron using your preferred package manager:
1212

1313
```bash
1414
# Using npm
15-
npm install duron
15+
npm install duron drizzle-orm@beta
1616

1717
# Using pnpm
18-
pnpm add duron
18+
pnpm add duron drizzle-orm@beta
1919

2020
# Using yarn
21-
yarn add duron
21+
yarn add duron drizzle-orm@beta
2222

2323
# Using bun
24-
bun add duron
24+
bun add duron drizzle-orm@beta
2525
```
2626

27-
Install postgres/pglite for the current database:
27+
Install postgres for the current database:
2828

2929
```bash
3030
# Using npm
31-
npm install postgres @electric-sql/pglite
31+
npm install postgres
3232

3333
# Using pnpm
34-
pnpm add postgres @electric-sql/pglite
34+
pnpm add postgres
3535

3636
# Using yarn
37-
yarn add postgres @electric-sql/pglite
37+
yarn add postgres
3838

3939
# Using bun
40-
bun add postgres @electric-sql/pglite
40+
bun add postgres
41+
```
42+
43+
Install pglite for the current database:
44+
45+
```bash
46+
# Using npm
47+
npm install @electric-sql/pglite
48+
49+
# Using pnpm
50+
pnpm add @electric-sql/pglite
51+
52+
# Using yarn
53+
yarn add @electric-sql/pglite
54+
55+
# Using bun
56+
bun add @electric-sql/pglite
4157
```
4258

4359
## Quick Start

packages/duron/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ A powerful, type-safe job queue system for Node.js and Bun.js. Duron provides a
66

77
```bash
88
# Using bun
9-
bun add duron postgres
9+
bun add duron postgres drizzle-orm@beta
1010

1111
# Using npm
12-
npm install duron postgres
12+
npm install duron postgres drizzle-orm@beta
1313

1414
# Using pnpm
15-
pnpm add duron postgres
15+
pnpm add duron postgres drizzle-orm@beta
1616

1717
# Using yarn
18-
yarn add duron postgres
18+
yarn add duron postgres drizzle-orm@beta
1919
```
2020

2121
## Quick Start

packages/duron/migrations/postgres/0000_lethal_speed_demon.sql

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
CREATE SCHEMA IF NOT EXISTS "duron";
2+
--> statement-breakpoint
3+
CREATE TABLE "duron"."job_steps" (
4+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
5+
"job_id" uuid NOT NULL,
6+
"name" text NOT NULL,
7+
"status" text DEFAULT 'active' NOT NULL,
8+
"output" jsonb,
9+
"error" jsonb,
10+
"started_at" timestamp with time zone DEFAULT now() NOT NULL,
11+
"finished_at" timestamp with time zone,
12+
"timeout_ms" integer NOT NULL,
13+
"expires_at" timestamp with time zone,
14+
"retries_limit" integer DEFAULT 0 NOT NULL,
15+
"retries_count" integer DEFAULT 0 NOT NULL,
16+
"delayed_ms" integer,
17+
"history_failed_attempts" jsonb DEFAULT '{}' NOT NULL,
18+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
19+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
20+
CONSTRAINT "unique_job_step_name" UNIQUE("job_id","name"),
21+
CONSTRAINT "job_steps_status_check" CHECK ("status" IN ('active','completed','failed','cancelled'))
22+
);
23+
--> statement-breakpoint
24+
CREATE TABLE "duron"."jobs" (
25+
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
26+
"action_name" text NOT NULL,
27+
"group_key" text NOT NULL,
28+
"status" text DEFAULT 'created' NOT NULL,
29+
"checksum" text NOT NULL,
30+
"input" jsonb DEFAULT '{}' NOT NULL,
31+
"output" jsonb,
32+
"error" jsonb,
33+
"timeout_ms" integer NOT NULL,
34+
"expires_at" timestamp with time zone,
35+
"started_at" timestamp with time zone,
36+
"finished_at" timestamp with time zone,
37+
"owner_id" text,
38+
"concurrency_limit" integer DEFAULT 10 NOT NULL,
39+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
40+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
41+
CONSTRAINT "jobs_status_check" CHECK ("status" IN ('created','active','completed','failed','cancelled'))
42+
);
43+
--> statement-breakpoint
44+
CREATE INDEX "idx_job_steps_job_id" ON "duron"."job_steps" ("job_id");--> statement-breakpoint
45+
CREATE INDEX "idx_job_steps_status" ON "duron"."job_steps" ("status");--> statement-breakpoint
46+
CREATE INDEX "idx_job_steps_name" ON "duron"."job_steps" ("name");--> statement-breakpoint
47+
CREATE INDEX "idx_job_steps_expires_at" ON "duron"."job_steps" ("expires_at");--> statement-breakpoint
48+
CREATE INDEX "idx_job_steps_job_status" ON "duron"."job_steps" ("job_id","status");--> statement-breakpoint
49+
CREATE INDEX "idx_job_steps_job_name" ON "duron"."job_steps" ("job_id","name");--> statement-breakpoint
50+
CREATE INDEX "idx_job_steps_output_fts" ON "duron"."job_steps" USING gin (to_tsvector('english', "output"::text));--> statement-breakpoint
51+
CREATE INDEX "idx_jobs_action_name" ON "duron"."jobs" ("action_name");--> statement-breakpoint
52+
CREATE INDEX "idx_jobs_status" ON "duron"."jobs" ("status");--> statement-breakpoint
53+
CREATE INDEX "idx_jobs_group_key" ON "duron"."jobs" ("group_key");--> statement-breakpoint
54+
CREATE INDEX "idx_jobs_started_at" ON "duron"."jobs" ("started_at");--> statement-breakpoint
55+
CREATE INDEX "idx_jobs_finished_at" ON "duron"."jobs" ("finished_at");--> statement-breakpoint
56+
CREATE INDEX "idx_jobs_expires_at" ON "duron"."jobs" ("expires_at");--> statement-breakpoint
57+
CREATE INDEX "idx_jobs_owner_id" ON "duron"."jobs" ("owner_id");--> statement-breakpoint
58+
CREATE INDEX "idx_jobs_checksum" ON "duron"."jobs" ("checksum");--> statement-breakpoint
59+
CREATE INDEX "idx_jobs_concurrency_limit" ON "duron"."jobs" ("concurrency_limit");--> statement-breakpoint
60+
CREATE INDEX "idx_jobs_action_status" ON "duron"."jobs" ("action_name","status");--> statement-breakpoint
61+
CREATE INDEX "idx_jobs_action_group" ON "duron"."jobs" ("action_name","group_key");--> statement-breakpoint
62+
CREATE INDEX "idx_jobs_input_fts" ON "duron"."jobs" USING gin (to_tsvector('english', "input"::text));--> statement-breakpoint
63+
CREATE INDEX "idx_jobs_output_fts" ON "duron"."jobs" USING gin (to_tsvector('english', "output"::text));--> statement-breakpoint
64+
ALTER TABLE "duron"."job_steps" ADD CONSTRAINT "job_steps_job_id_jobs_id_fkey" FOREIGN KEY ("job_id") REFERENCES "duron"."jobs"("id") ON DELETE CASCADE;

0 commit comments

Comments
 (0)