npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@forinda/kickjs-db-mysql

v2.0.1

Published

mysql2 adapter for @forinda/kickjs-db — MigrationAdapter + Kysely MysqlDialect (MySQL 8.0+)

Downloads

637

Readme

@forinda/kickjs-db-mysql

MySQL adapter for @forinda/kickjs-db. MySQL 8.0+ / MariaDB 10.5+ required.

Two factories:

  • mysqlDialect({ pool }) — query-layer dialect for createDbClient({ dialect }).
  • mysqlAdapter({ pool })MigrationAdapter for kick db migrate + kickDbAdapter boot-time apply.

Both consume an mysql2 pool (or any structurally compatible runtime).

Install

pnpm add @forinda/kickjs-db @forinda/kickjs-db-mysql mysql2

Quick start

import { createPool } from 'mysql2/promise'
import { createDbClient } from '@forinda/kickjs-db'
import { mysqlAdapter, mysqlDialect } from '@forinda/kickjs-db-mysql'

const pool = createPool({
  host: '127.0.0.1',
  user: 'root',
  password: '...',
  database: 'app',
})

export const db = createDbClient({
  schema, // your declared schema
  dialect: mysqlDialect({ pool }),
})

export const migrationAdapter = mysqlAdapter({ pool })

db.query.X.findMany({ with }) round-trips nested rows as parsed JS objects: MySQL's JSON aggregation returns TEXT, but createDbClient transparently parses it on the way back so adopters never see the encoded form.

MySQL 8.0+ / MariaDB 10.5+ required

The relational query layer compiles to JSON_ARRAYAGG, which shipped in MySQL 8.0 and MariaDB 10.5. mysqlAdapter() checks the version on first connection (lazily — no I/O at construction time). Older versions and unparseable strings throw KickDbError with code KICK_DB_RELATIONAL_NOT_SUPPORTED so adopters get a clear error before any query reaches the compiler.

The version parser (parseMysqlVersion) detects MariaDB via the version string and applies the correct floor per flavor:

  • MySQL — major >= 8.
  • MariaDB>= 10.5 (10.0 – 10.4 throw; 10.5+ and 11.x pass).

Multi-statement migrations

mysql2's default Pool.query() rejects multi-statement SQL unless the driver is configured with multipleStatements: true. The adapter splits SQL blobs at top-level ; boundaries (respecting string literals and -- / C-style block comments) so kickjs-generated migrations apply against default mysql2 settings. Adopters with multipleStatements: true on their pool pay no extra cost — the splitter is cheap on small DDL blobs.

Adopter-facing exports

  • parseMysqlVersion(version) — full parse returning { flavor, major, minor } for branching on MariaDB vs MySQL.
  • parseMysqlMajorVersion(version) — back-compat shim; major-only result.
  • splitMysqlStatements(sql) — multi-statement splitter for custom migration tooling outside the adapter.

Notes

  • Drift detection (introspect()) is not yet implemented in v1 — it throws KickDbError with code KICK_DB_INTROSPECT_NOT_SUPPORTED. Set driftCheck: 'off' on the migration runner until a follow-up adds the information_schema walk.

License

MIT © Felix Orinda