Skip to content

Commit c1007c2

Browse files
committed
update docs
1 parent ed6c060 commit c1007c2

File tree

3 files changed

+62
-12
lines changed

3 files changed

+62
-12
lines changed

apps/docs/content/docs/02.packages/adapter-drizzle.mdx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,11 @@ If you don't want to use the pre-defined schema, you can create your own schema
5555

5656
### Custom Table & Schema Names
5757

58-
You can customize the table and schema names used by the adapter by providing them in the adapter configuration:
58+
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:
5959

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

63-
// createQueueJobsTable allows to create a table with custom name and schema
64-
// without taking care about the field definitions
6563
export const { table: customQueueJobs, schema: customSchema } = createQueueJobsTable(
6664
"custom_queue_jobs", // your custom table name
6765
"custom_schema", // your custom schema name
@@ -76,10 +74,6 @@ import { PostgresQueueAdapter } from "@vorsteh-queue/adapter-drizzle"
7674
const adapter = new PostgresQueueAdapter(db, {
7775
// Your custom model name ( based on the example above - `table: customQueueJobs`)
7876
modelName: "customQueueJobs",
79-
// Your custom schema name
80-
schemaName: "custom_schema",
81-
// Your custom table name
82-
tableName: "custom_queue_jobs",
8377
})
8478
```
8579

apps/docs/content/docs/02.packages/adapter-kysely.mdx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,11 @@ If you don't want to use the pre-defined schema, you can create your own migrati
7171

7272
### Custom Table & Schema Names
7373

74-
You can customize the table and schema names used by the adapter by providing them in the adapter configuration:
74+
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:
7575

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

79-
// createQueueJobsTable allows to create a table with custom name and schema
80-
// without taking care about the field definitions
8179
export const { up, down } = createQueueJobsTable(
8280
// your custom table name
8381
"custom_queue_jobs",
@@ -103,8 +101,6 @@ const db = new Kysely<DB>({
103101
})
104102

105103
const adapter = new PostgresQueueAdapter(db, {
106-
// Your custom model name ( based on the example above - `custom_queue_jobs: QueueJobTableDefinition`)
107-
modelName: "custom_queue_jobs",
108104
// Your custom schema name
109105
schemaName: "custom_schema",
110106
// Your custom table name

apps/docs/content/docs/02.packages/adapter-prisma.mdx

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ The Prisma adapter provides PostgreSQL support using Prisma ORM, offering genera
1212

1313
## Quick Start
1414

15+
### With prisma-client-js
16+
1517
```typescript
1618
import { PrismaClient } from "@prisma/client"
1719

@@ -23,6 +25,21 @@ const adapter = new PostgresPrismaQueueAdapter(prisma)
2325
const queue = new Queue(adapter)
2426
```
2527

28+
### With prisma-client
29+
30+
```typescript
31+
import { PrismaPg } from "@prisma/adapter-pg"
32+
import { PrismaClient } from "src/generated/prisma/client"
33+
34+
import { PostgresPrismaQueueAdapter } from "@vorsteh-queue/adapter-prisma"
35+
import { Queue } from "@vorsteh-queue/core"
36+
37+
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
38+
const prisma = new PrismaClient({ adapter })
39+
const adapter = new PostgresPrismaQueueAdapter(prisma)
40+
const queue = new Queue(adapter)
41+
```
42+
2643
## Database Setup
2744

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

57+
### Custom Table & Schema Names
58+
59+
To use the custom table and schema with prisma, you have to customize the prisma schema.
60+
Here an example with custom schema and table name ( the relevant parts are highlighted ):
61+
62+
<RemoteCodeBlock
63+
source="./examples/prisma-custom-schema-table/prisma/schema.prisma"
64+
language="prisma"
65+
showToolbar={true}
66+
showLineNumbers={true}
67+
path="prisma/schema.prisma"
68+
focusedLines="16,19,44-45"
69+
/>
70+
71+
To use the custom table and schema in the adapter, pass the adapter configuration to the `PostgresQueueAdapter`:
72+
73+
```typescript
74+
import { PrismaPg } from "@prisma/adapter-pg"
75+
import { PrismaClient } from "src/generated/prisma/client"
76+
77+
import { PostgresPrismaQueueAdapter } from "@vorsteh-queue/adapter-prisma"
78+
import { Queue } from "@vorsteh-queue/core"
79+
80+
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL })
81+
const prisma = new PrismaClient({ adapter })
82+
83+
const adapter = new PostgresQueueAdapter(prisma, {
84+
// Your custom model name ( based on the example above )
85+
modelName: "CustomQueueJobs",
86+
// Your custom schema name
87+
schemaName: "custom_schema",
88+
// Your custom table name
89+
tableName: "custom_queue_jobs",
90+
})
91+
92+
const queue = new Queue(adapter)
93+
```
94+
95+
<Note title="Want to see it in action?">
96+
Checkout our prisma example with [custom schema and
97+
table](/docs/examples/prisma-custom-schema-table/).
98+
</Note>
99+
40100
### Migration
41101

42102
To run the migrations, we recommend to use the [`prisma cli`](https://www.prisma.io/docs/orm/tools/prisma-cli).

0 commit comments

Comments
 (0)