@atscript/db-mysql
v0.1.45
Published
MySQL adapter for @atscript/db with mysql2 driver support.
Downloads
444
Readme
MySQL adapter for @atscript/db using the mysql2 driver. Supports native FULLTEXT search, VECTOR columns (MySQL 9.0+), AUTO_INCREMENT, batched multi-row inserts, and full schema sync.
Includes MysqlPlugin for @db.mysql.* annotations (engine, charset, collation, unsigned, type overrides, ON UPDATE).
Installation
pnpm add @atscript/db-mysql mysql2Quick Start
import { DbSpace } from "@atscript/db";
import { createAdapter } from "@atscript/db-mysql";
const db = createAdapter("mysql://root@localhost:3306/mydb");
const users = db.getTable(UsersType);
await users.insertOne({ name: "Alice", email: "[email protected]" });Features
- Full CRUD with batched multi-row INSERT (auto-chunking)
- Native FULLTEXT search via
MATCH ... AGAINST - VECTOR(N) column type on MySQL 9.0+ with distance functions
- AUTO_INCREMENT with configurable start value
- Storage engine selection (InnoDB, MyISAM, etc.)
- Character set and collation control
- UNSIGNED integer columns, native type overrides, ON UPDATE expressions
- Foreign key constraints with referential actions
- Full schema sync: CREATE, ALTER, DROP, indexes, views
Documentation
License
MIT
