Skip to content

deanc/kysely-schema-generator

Repository files navigation

Kysely schema generator

A very quickly hacked-together schema generator for Kysely which (currently) only supports MySQL.

Installation

With your package manager of choice install:

npm install --save @deanc/kysely-schema-generator
yarn add @deanc/kysely-schema-generator
pnpm add @deanc/kysely-schema-generator

Configuration

Either in your project root or somewhere else create a .env file with a DATABASE_URL environmental variable:

DATABASE_URL='mysql://user:password@host:3306/databaseName'

Usage

Option 1 (.env in project root and run)

kysely-schema-generator

Option 2 (.env somewhere else)

kysely-schema-generator -p /path/to/.env

Note if command can't be found you might need to use your package manager to run it (e.g. pnpm exec kysely-schema-generator)

Todo

(Contributions very welcome)

  • Ensure all MySQL field types are mapped correctly
  • Add support for other database engines (Postgres, SQLite at least)
  • Add test coverage
  • (Maybe) offer option to write to disk instead of relying on user to capture

About

A schema generator for kysely

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •