Registry / database / tool-mysql

tool-mysql

JSON →
library0.0.4jsnpmunverified

A lightweight MySQL query builder focused on CREATE TABLE statements. Version 0.0.4 is the latest stable release. It generates SQL from a JavaScript configuration object, supporting auto-increment, primary keys, indexes, foreign keys with ON UPDATE/ON DELETE options, and character set/collation per table and column. Differentiated from larger ORMs by its minimal scope and simple declarative API. No releases since initial publish; maintenance unknown.

npm install tool-mysql
INSTALL
IMPORT
SIG · TOOL-MYSQL
T
tool-mysql
databasejavascriptv0.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createTable
const { createTable } = require('tool-mysql')
import { createTable } from 'tool-mysql'
Package uses CommonJS; no ESM exports. Use require().
default
const toolMysql = require('tool-mysql')
import toolMysql from 'tool-mysql'
No default export; the entire module is an object with createTable method.
createTable
const toolMysql = require('tool-mysql'); toolMysql.createTable(config)
require('tool-mysql').createTable(config)
CommonJS require returns the module; call method on it.

Generate a MySQL CREATE TABLE statement from a configuration object, including auto-increment primary key and indexed column.

const toolMysql = require('tool-mysql'); const config = { tableName: 'users', columnData: [ { name: 'id', type: { name: 'INT', size: 11 }, ai: 1, primaryKey: 1 }, { name: 'name', type: { name: 'VARCHAR', size: 255 }, null: 1 }, { name: 'email', type: { name: 'VARCHAR', size: 255 }, index: 1 } ] }; const sql = toolMysql.createTable(config); console.log(sql);
Debug
Known issues
gotchaPackage is CommonJS-only; attempting ESM import will fail.
fix
Use require('tool-mysql') instead of import.
affects: >=0.0.0
gotchaNo type definitions included; TypeScript users must declare module manually.
fix
Create a .d.ts file with declare module 'tool-mysql' and export function signature.
affects: >=0.0.0
gotchaForeign key options must use exact case: 'RESTRICT', 'CASCADE', 'SET NULL', 'NO ACTION', 'SET DEFAULT'. Mismatched case causes silent ignore.
fix
Ensure option values are uppercase as documented.
affects: >=0.0.0
deprecatedPackage has not been updated since 2019; may not support MySQL 8+ features.
fix
Consider using up-to-date alternatives like knex.js or typeorm.
affects: 0.0.4
Errors
Common errors & fixes
Error: Cannot find module 'tool-mysql'
Package not installed or misspelled.
fix
Run 'npm install tool-mysql' and verify package.json dependencies.
TypeError: toolMysql.createTable is not a function
Default import used instead of require or wrong export access.
fix
Use: const toolMysql = require('tool-mysql');
SyntaxError: Unexpected token 'export'
Attempting to use ES module import on CommonJS package.
fix
Use require() as the package does not support ESM.
ReferenceError: require is not defined
Running in browser or ES module context where require is unavailable.
fix
Use bundler (e.g., webpack) or convert to ESM import if package provides it (it doesn't).
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Meta
1
OpenAI (training)
1
Resources
tool-mysql — npm install tool-mysql · libregistry