Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
b735b6a
add missing `queryRawUnsafe` to the internal prisma client
noxify Oct 27, 2025
7ddef9f
prisma adapter: added initial support for custom schema & tablename
noxify Oct 27, 2025
05a2588
update deps
noxify Oct 29, 2025
1e7c407
working custom config for prisma adapter
noxify Oct 29, 2025
b85c294
start updating drizzle adapter
noxify Oct 29, 2025
8b56832
fix lint iisues
noxify Oct 29, 2025
2b7bdce
working drizzle adapter with custom schema & tablename
noxify Nov 4, 2025
e54e76e
fix kysely tests
noxify Nov 4, 2025
c3c08f3
add missing testcases
noxify Nov 4, 2025
0332e46
fix prisma tests
noxify Nov 4, 2025
0fd38e7
fix node tests
noxify Nov 4, 2025
3e943d3
add node 24
noxify Nov 4, 2025
04aac4c
update deps & fix ci issues
noxify Nov 4, 2025
1c106e7
working kysely implementation
noxify Nov 4, 2025
aa22a40
feat: add helper for dynamic schema and table names generation
noxify Nov 5, 2025
2133e8b
update deps
noxify Nov 5, 2025
f485be2
update return structure in createQueueJobsTable function
noxify Nov 5, 2025
e1181f1
update exports
noxify Nov 5, 2025
27a66f8
fix type issue in drizzle adapter while using a custom model/schema/t…
noxify Nov 5, 2025
62a2784
add custom schema/table example for kysely and prisma-client
noxify Nov 5, 2025
2b0beb2
fix duplicate name issue in examples
noxify Nov 5, 2025
7a2f66a
update deps
noxify Nov 5, 2025
1c0da76
update drizzle docs
noxify Nov 5, 2025
3b49857
update kysely docs
noxify Nov 5, 2025
239d749
fix `Note` styling
noxify Nov 5, 2025
caa670a
revert readme changes
noxify Nov 5, 2025
b9fb66c
use create table helper in kysely examples
noxify Nov 5, 2025
ed6c060
add `createQueueJobsTable´ helper to the kysely adapter
noxify Nov 5, 2025
c1007c2
update docs
noxify Nov 5, 2025
212f3c4
use adapter specific adapter props
noxify Nov 5, 2025
e1791ca
remove unused adapter props from custom schema examples
noxify Nov 5, 2025
b03d5b4
update changeset
noxify Nov 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .changeset/crazy-colts-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
"@vorsteh-queue/adapter-drizzle": minor
"@vorsteh-queue/adapter-kysely": minor
"@vorsteh-queue/adapter-prisma": minor
"@vorsteh-queue/core": minor
---

## Dynamic Schema & Table Names

- All adapters (Drizzle, Kysely, Prisma) now support configurable schema and table names for queue jobs.
- Enables an easier integration in existing DB setups.

## Example: Drizzle Adapter with Custom Schema & Table

```typescript
// drizzle-schema.ts
import { createQueueJobsTable } from "@vorsteh-queue/adapter-drizzle"

export const { table: customQueueJobs, schema: customSchema } = createQueueJobsTable(
"custom_queue_jobs",
"custom_schema",
)

// queue.ts
import { drizzle } from "drizzle-orm/node-postgres"
import { Pool } from "pg"
import * as schema from "src/drizzle-schema.ts2

import { PostgresQueueAdapter } from "@vorsteh-queue/adapter-drizzle"

const pool = new Pool({ connectionString: process.env.DATABASE_URL })
const db = drizzle(pool, { schema })

const adapter = new PostgresQueueAdapter(db, {
modelName: "customQueueJobs",
})

// The queue will now use the specified schema and table
const queue = new Queue(adapter, { name: "my-queue" })
```
5 changes: 5 additions & 0 deletions .changeset/upset-symbols-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-vorsteh-queue": patch
---

update deps
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
node-version: [20, 22, 24]
name: Test (Node.js ${{ matrix.node-version }})
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -67,7 +67,7 @@ jobs:

- name: Test Prisma
run: |
pnpm -F adapter-prisma prisma:generate
pnpm -F adapter-prisma prisma:generate_test
pnpm test:prisma
env:
# Ensure Docker is available for Testcontainers
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:

- name: Test PostgreSQL (Postgres ${{ matrix.pg-version }})
run: |
pnpm -F adapter-prisma prisma:generate
pnpm -F adapter-prisma prisma:generate_test
pnpm test:prisma
env:
# Ensure Docker is available for Testcontainers
Expand Down
35 changes: 32 additions & 3 deletions apps/docs/content/docs/02.packages/adapter-drizzle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ const queue = new Queue(adapter)

## Supported providers

- PGlite
- Postgres.JS
- Node Progress
- PGlite - https://orm.drizzle.team/docs/connect-pglite
- Postgres.JS - https://orm.drizzle.team/docs/get-started-postgresql#postgresjs
- Node Progress - https://orm.drizzle.team/docs/get-started-postgresql#node-postgres

## Database Setup

Expand All @@ -53,6 +53,35 @@ If you don't want to use the pre-defined schema, you can create your own schema
path="queue-jobs.ts"
/>

### Custom Table & Schema Names

To create a table with custom name and schema, you can use the `createQueueJobsTable` helper, which will create the table without taking care about the field definitions:

```typescript path="drizzle-schema.ts"
import { createQueueJobsTable } from "@vorsteh-queue/adapter-drizzle"

export const { table: customQueueJobs, schema: customSchema } = createQueueJobsTable(
"custom_queue_jobs", // your custom table name
"custom_schema", // your custom schema name
)
```

To use the custom table and schema in the adapter, pass the adapter configuration to the `PostgresQueueAdapter`:

```typescript
import { PostgresQueueAdapter } from "@vorsteh-queue/adapter-drizzle"

const adapter = new PostgresQueueAdapter(db, {
// Your custom model name ( based on the example above - `table: customQueueJobs`)
modelName: "customQueueJobs",
})
```

<Note title="Want to see it in action?">
Checkout our drizzle example with [custom schema and
table](/docs/examples/drizzle-custom-schema-table/).
</Note>

### Migration

To run the migrations, we recommend to use [`drizzle-kit`](https://orm.drizzle.team/docs/kit-overview).
Expand Down
60 changes: 50 additions & 10 deletions apps/docs/content/docs/02.packages/adapter-kysely.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,18 @@ const queue = new Queue(adapter)

## Supported providers

- PGlite
- Postgres.JS
- Node Progress
- PGlite - https://github.com/czeidler/kysely-pglite-dialect
- Postgres.JS - https://github.com/kysely-org/kysely-postgres-js
- Node Progress - https://kysely-org.github.io/kysely-apidoc/classes/PostgresDialect.html

## Database Setup

### Schema

The adapter includes a pre-defined migration:

```typescript
// migrations/queue-jobs.ts
import { down, up } from "@vorsteh-queue/adapter-kysely/migrations"

// Use in your schema file
export { up, down }
```typescript path="migrations/queue-jobs.ts"
export { down, up } from "@vorsteh-queue/adapter-kysely/migrations"
```

If you don't want to use the pre-defined schema, you can create your own migration.
Expand All @@ -70,9 +66,53 @@ If you don't want to use the pre-defined schema, you can create your own migrati
source="./packages/adapter-kysely/src/migrations/queue_table.ts"
language="ts"
showToolbar={true}
path="queue-jobs.ts"
path="/migrations/queue-jobs.ts"
/>

### Custom Table & Schema Names

To create a table with custom name and schema, you can use the `createQueueJobsTable` helper, which will create the table without taking care about the field definitions:

```typescript path="migrations/queue-jobs.ts"
import { createQueueJobsTable } from "@vorsteh-queue/adapter-kysely"

export const { up, down } = createQueueJobsTable(
// your custom table name
"custom_queue_jobs",
// your custom schema name
"custom_schema",
)
```

To use the custom table and schema in the adapter, pass the adapter configuration to the `PostgresQueueAdapter`:

```typescript
import { Kysely } from "kysely"

import type { QueueJobTableDefinition } from "@vorsteh-queue/adapter-kysely/types"
import { PostgresQueueAdapter } from "@vorsteh-queue/adapter-kysely"

interface DB {
custom_queue_jobs: QueueJobTableDefinition
}

const db = new Kysely<DB>({
//... your Kysely configuration
})

const adapter = new PostgresQueueAdapter(db, {
// Your custom schema name
schemaName: "custom_schema",
// Your custom table name
tableName: "custom_queue_jobs",
})
```

<Note title="Want to see it in action?">
Checkout our kysely example with [custom schema and
table](/docs/examples/kysely-custom-schema-table/).
</Note>

### Migration

To run the migrations, we recommend to use [`kysely-ctl`](https://github.com/kysely-org/kysely-ctl).
Expand Down
60 changes: 60 additions & 0 deletions apps/docs/content/docs/02.packages/adapter-prisma.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The Prisma adapter provides PostgreSQL support using Prisma ORM, offering genera

## Quick Start

### With prisma-client-js

```typescript
import { PrismaClient } from "@prisma/client"

Expand All @@ -23,6 +25,21 @@ const adapter = new PostgresPrismaQueueAdapter(prisma)
const queue = new Queue(adapter)
```

### With prisma-client

```typescript
import { PrismaPg } from "@prisma/adapter-pg"
import { PrismaClient } from "src/generated/prisma/client"

import { PostgresPrismaQueueAdapter } from "@vorsteh-queue/adapter-prisma"
import { Queue } from "@vorsteh-queue/core"

const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })
const adapter = new PostgresPrismaQueueAdapter(prisma)
const queue = new Queue(adapter)
```

## Database Setup

### Schema
Expand All @@ -37,6 +54,49 @@ Add the queue job model to your `schema.prisma`:
focusedLines="17-43"
/>

### Custom Table & Schema Names

To use the custom table and schema with prisma, you have to customize the prisma schema.
Here an example with custom schema and table name ( the relevant parts are highlighted ):

<RemoteCodeBlock
source="./examples/prisma-custom-schema-table/prisma/schema.prisma"
language="prisma"
showToolbar={true}
showLineNumbers={true}
path="prisma/schema.prisma"
focusedLines="16,19,44-45"
/>

To use the custom table and schema in the adapter, pass the adapter configuration to the `PostgresQueueAdapter`:

```typescript
import { PrismaPg } from "@prisma/adapter-pg"
import { PrismaClient } from "src/generated/prisma/client"

import { PostgresPrismaQueueAdapter } from "@vorsteh-queue/adapter-prisma"
import { Queue } from "@vorsteh-queue/core"

const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
const prisma = new PrismaClient({ adapter })

const adapter = new PostgresQueueAdapter(prisma, {
// Your custom model name ( based on the example above )
modelName: "CustomQueueJobs",
// Your custom schema name
schemaName: "custom_schema",
// Your custom table name
tableName: "custom_queue_jobs",
})

const queue = new Queue(adapter)
```

<Note title="Want to see it in action?">
Checkout our prisma example with [custom schema and
table](/docs/examples/prisma-custom-schema-table/).
</Note>

### Migration

To run the migrations, we recommend to use the [`prisma cli`](https://www.prisma.io/docs/orm/tools/prisma-cli).
Expand Down
20 changes: 10 additions & 10 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"@mdx-js/loader": "3.1.1",
"@mdx-js/node-loader": "3.1.1",
"@mdx-js/react": "3.1.1",
"@next/mdx": "16.0.0",
"@next/mdx": "16.0.1",
"@radix-ui/react-collapsible": "^1.1.12",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-dropdown-menu": "2.1.16",
"@radix-ui/react-id": "1.1.1",
"@radix-ui/react-primitive": "2.1.3",
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-primitive": "2.1.4",
"@radix-ui/react-separator": "^1.1.8",
"@radix-ui/react-slot": "^1.2.4",
"@radix-ui/react-tabs": "1.1.13",
"@radix-ui/react-tooltip": "^1.2.8",
"@vercel/og": "0.8.5",
Expand All @@ -40,9 +40,9 @@
"date-fns": "^4.1.0",
"globby": "15.0.0",
"interweave": "13.1.1",
"lucide-react": "0.548.0",
"lucide-react": "0.552.0",
"multimatch": "7.0.0",
"next": "16.0.0",
"next": "16.0.1",
"next-themes": "latest",
"p-map": "7.0.3",
"react": "19.2.0",
Expand All @@ -54,8 +54,8 @@
"remark-mdx-frontmatter": "5.2.0",
"remark-squeeze-paragraphs": "6.0.0",
"remark-strip-badges": "7.0.0",
"renoun": "10.7.0",
"tm-grammars": "1.25.1",
"renoun": "10.9.0",
"tm-grammars": "1.25.3",
"tm-themes": "1.10.12",
"ts-morph": "27.0.2",
"tw-animate-css": "^1.4.0",
Expand All @@ -66,7 +66,7 @@
"@tailwindcss/postcss": "4.1.16",
"@tailwindcss/typography": "0.5.19",
"@types/mdx": "2.0.13",
"@types/node": "22.18.12",
"@types/node": "22.19.0",
"@types/react": "19.2.2",
"@types/react-dom": "19.2.2",
"@types/serve-handler": "6.1.4",
Expand All @@ -77,7 +77,7 @@
"@vorsteh-queue/eslint-config": "workspace:*",
"@vorsteh-queue/prettier-config": "workspace:*",
"@vorsteh-queue/tsconfig": "workspace:*",
"eslint": "^9.38.0",
"eslint": "^9.39.1",
"next-validate-link": "1.6.3",
"pagefind": "1.4.0",
"postcss": "8.5.6",
Expand Down
5 changes: 1 addition & 4 deletions apps/docs/src/app/(site)/(docs)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ export default async function DocsLayout(props: LayoutProps<"/">) {
<SidebarInset className="bg-white dark:bg-secondary">
<div className="flex flex-1 flex-col gap-4 pb-[calc(var(--footer-height)+1rem)]">
<main className="flex w-full flex-1 flex-col transition-all duration-300 ease-in-out">
{
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
props.children
}
{props.children}
</main>
</div>
</SidebarInset>
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/src/mdx-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ export function useMDXComponents() {
return (
<Alert variant={"default"} className="my-4">
{title && <AlertTitle>{title}</AlertTitle>}
<AlertDescription>{children}</AlertDescription>
<AlertDescription className="block">{children}</AlertDescription>
</Alert>
)
},
Warning: ({ title, children }: { title?: string; children: ReactNode }) => {
return (
<Alert variant={"destructive"} className="my-4">
{title && <AlertTitle>{title}</AlertTitle>}
<AlertDescription>{children}</AlertDescription>
<AlertDescription className="block">{children}</AlertDescription>
</Alert>
)
},
Expand Down
2 changes: 1 addition & 1 deletion examples/batch-processing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"postgres": "^3.4.7"
},
"devDependencies": {
"drizzle-kit": "^0.31.5",
"drizzle-kit": "^0.31.6",
"tsx": "4.20.6",
"typescript": "^5.9.3"
}
Expand Down
1 change: 1 addition & 0 deletions examples/drizzle-custom-schema-table/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgresql://postgres:password@localhost:5432/queue_db
Loading
Loading