Easily work with relational databases in Javascript and Typescript
Relational-schema is a utility package to generate a semantic, complete schema of a relational database (PostgreSQL, MySQL) in Javascript, JSON and other formats.
Relational-schema is built on top of trusted open-source projects:
Works with MySQL and PostgreSQL. SQLite coming soon.
Full docs here
Why Relational-schema?
One of the key benefits of working with relational databases is the strict schema. Often in our applications we fail to take advantage of this, instead we rely on handwritten simplifications such as ORM models.
Relational-schema gives TS/JS developers a complete database schema including some nice additions (see below for specs).
The schema can be output in json
, es6
, typescript
and commonJS
to suit multiple use-cases.
This schema can be used for building better, more automated tooling for working with relational databases in JS.
Projects using Relational-schema
- Gybson - an auto generated, typesafe, flexible query client for working with relational databases in typescript.
Usage
Create a config file introspect-config.json
The schema will be generated in outdir
in the chosen format.
Key features:
Full table definitions including:
- columns (names, types, default values, nullability...)
- keys and constraints
- unique-ness
- Typescript type mappings
- table relations (including direction, transitive relations)
- human readable relation alias'
- soft-delete idenfication
- enums