Skip to content

Commit 3098ceb

Browse files
committed
support mariadb
1 parent 90a1bb0 commit 3098ceb

20 files changed

+4133
-119
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,17 @@ jobs:
5858
- name: Setup
5959
uses: ./.github/setup
6060

61-
- name: Unittest
62-
run: pnpm test
61+
- name: Test Core Package
62+
run: turbo test --filter=@vorsteh-queue/core
63+
64+
- name: Test Drizzle PostgreSQL (PGlite)
65+
run: pnpm test:drizzle-postgres
66+
67+
- name: Test Drizzle MariaDB (Testcontainers)
68+
run: pnpm test:drizzle-mariadb
69+
env:
70+
# Ensure Docker is available for Testcontainers
71+
TESTCONTAINERS_RYUK_DISABLED: true
6372

6473
pkg-new-release:
6574
needs: [lint, format, typecheck, unittest]

README.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<div align="center">
22
<img src="./assets/vorsteh-queue-logo-nobg.png" alt="Vorsteh Queue" height="200" />
33
<h1>Vorsteh Queue</h1>
4-
<p>A TypeScript-first job queue system with multiple database adapters, built for reliability and developer experience.</p>
4+
<p>A powerful, ORM-agnostic queue engine that works with any orm. Handle background jobs, scheduled tasks, and recurring processes with ease.</p>
55
</div>
66

77
## Features
88

99
- **Type-safe**: Full TypeScript support with generic job payloads
10-
- **Multiple adapters**: Drizzle ORM and in-memory implementations (Prisma coming soon)
10+
- **Multiple adapters**: Drizzle ORM (PostgreSQL + MariaDB/MySQL) and in-memory implementations
1111
- **Priority queues**: Numeric priority system (lower = higher priority)
1212
- **Delayed jobs**: Schedule jobs for future execution
1313
- **Recurring jobs**: Cron expressions and interval-based repetition
@@ -22,7 +22,7 @@
2222
.
2323
├── packages/
2424
│ ├── core/ # Core queue logic and interfaces
25-
│ ├── adapter-drizzle/ # Drizzle ORM adapter
25+
│ ├── adapter-drizzle/ # Drizzle ORM adapter (PostgreSQL + MariaDB/MySQL)
2626
│ └── adapter-prisma/ # Prisma adapter (coming soon)
2727
├── examples/ # Standalone usage examples
2828
│ ├── drizzle-pg/ # Drizzle + node-postgres
@@ -46,16 +46,30 @@ pnpm add @vorsteh-queue/core @vorsteh-queue/adapter-drizzle
4646
### Basic Usage
4747

4848
```typescript
49+
// PostgreSQL
4950
import { drizzle } from "drizzle-orm/node-postgres"
5051
import { Pool } from "pg"
51-
52-
import { DrizzleQueueAdapter } from "@vorsteh-queue/adapter-drizzle"
52+
import { PostgresQueueAdapter } from "@vorsteh-queue/adapter-drizzle"
5353
import { Queue } from "@vorsteh-queue/core"
5454

55-
// Setup database and queue
5655
const pool = new Pool({ connectionString: "postgresql://..." })
5756
const db = drizzle(pool)
58-
const adapter = new DrizzleQueueAdapter(db, "my-queue")
57+
const adapter = new PostgresQueueAdapter(db, "my-queue")
58+
const queue = new Queue(adapter, { name: "my-queue" })
59+
60+
// MariaDB/MySQL
61+
import { drizzle } from "drizzle-orm/mysql2"
62+
import mysql from "mysql2/promise"
63+
import { MariaDBQueueAdapter } from "@vorsteh-queue/adapter-drizzle"
64+
65+
const connection = await mysql.createConnection({
66+
host: "localhost",
67+
user: "root",
68+
password: "password",
69+
database: "queue_db"
70+
})
71+
const db = drizzle(connection, { mode: "default" })
72+
const adapter = new MariaDBQueueAdapter(db, "my-queue")
5973
const queue = new Queue(adapter, { name: "my-queue" })
6074

6175
// Register job handlers
@@ -241,9 +255,14 @@ queue.on("queue:resumed", () => {
241255
# Install dependencies
242256
pnpm install
243257

244-
# Run tests
258+
# Run all tests
245259
pnpm test
246260

261+
# Run specific test suites
262+
pnpm test:core # Core package tests
263+
pnpm test:drizzle-postgres # PostgreSQL adapter tests
264+
pnpm test:drizzle-mariadb # MariaDB adapter tests
265+
247266
# Type check
248267
pnpm typecheck
249268

apps/docs/next.config.mjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
import createMDXPlugin from "@next/mdx"
2+
import { rehypePlugins, remarkPlugins } from "renoun/mdx"
3+
4+
const withMDX = createMDXPlugin({
5+
extension: /\.mdx?$/,
6+
options: {
7+
remarkPlugins,
8+
rehypePlugins,
9+
},
10+
})
11+
112
/** @type {import('next').NextConfig} */
213
const nextConfig = {
314
output: "export",
@@ -22,4 +33,4 @@ const nextConfig = {
2233
},
2334
}
2435

25-
export default nextConfig
36+
export default withMDX(nextConfig)

apps/docs/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"build": "next build",
7+
"build": "renoun next build",
88
"clean": "git clean -xdf .cache .turbo dist node_modules .next",
99
"clean:cache": "git clean -xdf .cache",
10-
"dev": "next dev",
10+
"dev": "renoun next dev",
1111
"format": "prettier --check . --ignore-path ../../.gitignore",
1212
"lint": "eslint .",
1313
"start": "next start",
1414
"typecheck": "tsc --noEmit"
1515
},
1616
"prettier": "@vorsteh-queue/prettier-config",
1717
"dependencies": {
18+
"@next/mdx": "15.4.1",
1819
"class-variance-authority": "0.7.1",
1920
"clsx": "2.1.1",
2021
"cmdk": "1.1.1",
@@ -23,7 +24,9 @@
2324
"next": "15.4.1",
2425
"next-themes": "latest",
2526
"react": "19.1.0",
26-
"react-dom": "19.1.0"
27+
"react-dom": "19.1.0",
28+
"renoun": "8.14.0",
29+
"ts-morph": "26.0.0"
2730
},
2831
"devDependencies": {
2932
"@tailwindcss/postcss": "4.1.11",

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"deps:update": "pnpm update -i -L -r",
2828
"test": "vitest",
2929
"test:ui": "vitest --ui",
30+
"test:core": "turbo test --filter=@vorsteh-queue/core",
31+
"test:drizzle-postgres": "turbo test:postgres",
32+
"test:drizzle-mariadb": "turbo test:mariadb",
3033
"prune": "turbo prune --docker",
3134
"cs": "changeset",
3235
"ci:publish": "pnpm build && pnpm publish -r --access public --publish-branch main && pnpm changeset tag",
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# MariaDB Testing Setup
2+
3+
## Prerequisites
4+
5+
1. **Docker Desktop** must be installed and running
6+
2. **Node.js 18+** and **pnpm** installed
7+
8+
## Quick Start
9+
10+
```bash
11+
# 1. Start Docker Desktop
12+
# 2. Install dependencies
13+
pnpm install
14+
15+
# 3. Run MariaDB tests
16+
pnpm test:mariadb
17+
18+
# 4. Run all tests
19+
pnpm test
20+
```
21+
22+
## Manual MariaDB Setup (Alternative)
23+
24+
If you prefer not to use Docker:
25+
26+
```bash
27+
# Install MariaDB locally (macOS)
28+
brew install mariadb
29+
brew services start mariadb
30+
31+
# Create test database
32+
mysql -u root -e "CREATE DATABASE testdb;"
33+
34+
# Set environment variables
35+
export MARIADB_HOST=localhost
36+
export MARIADB_PORT=3306
37+
export MARIADB_USER=root
38+
export MARIADB_PASSWORD=
39+
export MARIADB_DATABASE=testdb
40+
41+
# Run tests
42+
pnpm test:mariadb:local
43+
```
44+
45+
## Test Commands
46+
47+
- `pnpm test:mariadb` - Run MariaDB tests with Testcontainers
48+
- `pnpm test:postgres` - Run PostgreSQL tests with PGlite
49+
- `pnpm test` - Run all tests
50+
- `pnpm test:watch` - Run tests in watch mode
51+
52+
## Troubleshooting
53+
54+
### Docker Issues
55+
56+
- Ensure Docker Desktop is running
57+
- Try: `docker pull mariadb:10.6`
58+
- Check Docker permissions
59+
60+
### Connection Issues
61+
62+
- MariaDB container takes ~10-15 seconds to start
63+
- Tests have 2-minute timeout for container startup
64+
- Check firewall settings
65+
66+
### Performance
67+
68+
- First run downloads MariaDB image (~200MB)
69+
- Subsequent runs are much faster
70+
- Container startup: ~10-15 seconds
71+
72+
## What the Tests Verify
73+
74+
**Basic Operations**
75+
76+
- Job creation and retrieval
77+
- SKIP LOCKED functionality
78+
- Status updates
79+
- Queue statistics
80+
81+
**MariaDB-Specific Features**
82+
83+
- UUID generation with VARCHAR(36)
84+
- JSON payload handling
85+
- MySQL-specific query patterns
86+
87+
**Scheduling Features**
88+
89+
- Cron job support
90+
- Recurring jobs
91+
- Delayed job processing
92+
93+
## CI/CD Integration
94+
95+
The tests work in GitHub Actions automatically:
96+
97+
```yaml
98+
- name: Run MariaDB tests
99+
run: pnpm test:mariadb
100+
```
101+
102+
Docker is pre-installed in GitHub runners, so no additional setup needed.

0 commit comments

Comments
 (0)