Restaq
Database

MySQL

Use a mysql2 pool as your Restaq execution store.

Pass a mysql2 pool straight into restaq({ database }). Restaq detects the dialect automatically and applies its own schema migrations.

pnpm add mysql2
// relay.ts
import { restaq as createRestaq } from 'restaq';
import { createPool } from 'mysql2';

export const restaq = createRestaq({
  database: createPool({
    uri: process.env.DATABASE_URL!,
    timezone: 'Z', // keeps timestamps consistent in UTC
  }),
  plugins: [
    // ...
  ],
});

Use mysql2's pool directly, not mysql2/promise. Both Restaq's dialect detection and Kysely, the query engine underneath, expect the callback-style pool.

Recommended for production, and for any deployment running more than one instance of your app. See Migrations for how to apply schema changes before scaling up.