https://github.com/deanc/kysely-schema-generator
A schema generator for kysely
https://github.com/deanc/kysely-schema-generator
Last synced: 10 months ago
JSON representation
A schema generator for kysely
- Host: GitHub
- URL: https://github.com/deanc/kysely-schema-generator
- Owner: deanc
- License: agpl-3.0
- Created: 2023-10-19T20:27:25.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-22T19:17:40.000Z (over 2 years ago)
- Last Synced: 2025-06-18T00:38:44.312Z (about 1 year ago)
- Language: TypeScript
- Size: 80.1 KB
- Stars: 13
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Kysely schema generator
A very quickly hacked-together schema generator for [Kysely](https://kysely.dev/) which (currently) only
supports MySQL.
## Installation
With your package manager of choice install:
```sh
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:
```shell
DATABASE_URL='mysql://user:password@host:3306/databaseName'
```
## Usage
**Option 1 (.env in project root and run)**
```sh
kysely-schema-generator
```
**Option 2 (.env somewhere else)**
```sh
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