sql-ts-knex-generator
v1.8.1
Published
A simple command line tool to generate typescript CRUD operations from database schemas.
Downloads
34
Maintainers
Readme
A simple command line tool to generate typescript CRUD operations
Generate CRUD operations and TypeScript interfaces from database schemas.
Supports the following databases: MySQL, Microsoft SQL Server, SQLite and PostgreSQL.
How to use
npx sql-ts-knex-generator -c ./config.json
example config file:
{
"client": "mssql",
"tables": ["dbo.TABLE_NAME"],
"connection": {
"server": "********",
"database": "*******",
"user": "*******",
"password": "********",
"options": {
"encrypt": true,
"enableArithAbort": true
},
"requestTimeout": 15000,
"connectionTimeout": 15000
}
}
It will create a folder and generate a file for each table containing CRUD (create, read, update, delete) functions based on DB schema.
It respects nullable and required fields.
Config file options
Config file options OR sql-ts docs