A CLI tool and library to generate TypeScript interfaces, classes, and MySQL table schemas from database definitions. Current stable version is 1.12.0. The package relies on knex for database introspection and handlebars for templating. It is primarily used as a code generator to scaffold TypeScript models from an existing MySQL database. Release cadence is low; last update was in 2020. Differentiators include generating both TypeScript types and MySQL create table statements, and handling change-case and pluralization automatically.
npm install typescript-mysql-modelNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Generates TypeScript model files from a MySQL database using a config object for connection and output settings.
Ensure MySQL server is running and accessible with the given credentials.
Consider using knex directly or another ORM for better compatibility.
Check for newer alternatives like typeorm or prisma.
Make sure to version control your generated models or backup before running.
Run npm install knex@0.21.1 mysql --save-dev
Use import { generateModelFiles } from 'typescript-mysql-model'Run ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; or upgrade to mysql2.