Skip to content

Generate TypeScript definitions and CRUD functions from database schemas.

Notifications You must be signed in to change notification settings

saostad/sql-ts-knex-generator

Repository files navigation

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

Credits:

About

Generate TypeScript definitions and CRUD functions from database schemas.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published