An open API service indexing awesome lists of open source software.

https://github.com/klarna-incubator/postgres-to-docs

The smoooth way to document your postgres database
https://github.com/klarna-incubator/postgres-to-docs

hacktoberfest markdown nodejs postgres postgresql typescript

Last synced: 3 days ago
JSON representation

The smoooth way to document your postgres database

Awesome Lists containing this project

README

        

# postgres-to-docs
[![Build Status][ci-image]][ci-url]
[![License][license-image]][license-url]
[![Developed at Klarna][klarna-image]][klarna-url]

Make your database documentation smoooth by generating markdown for your schema.

## Usage

1. Install through npm
```
npm install @klarna/postgres-to-docs
```

2. Define a `json` config file
```
{
"host": "localhost",
"port": 5432,
"user": "user",
"password": "password",
"database": "database"
}
```
3. Run the tool
```
postgres-to-docs --config=config.json --output=schema.md
```
Where `--config` is the path to your config file and `--output`is the path to the output markdown file

## Problem
You need to get a quick and easy overview of your database schema but don't want to...
* Open the source code and find the model definitions
* Start your database and service, install dependencies, have a proper configuration, and open an external tool like TablePlus or DBeaver
* Read through your migrations directory to find the latest version of your schema
* Look through external documentation that might be out of date

## Introducing postgres-to-docs!
A Node CLI that renders your schemas as markdown and keeps it up to date! Generates documentation for
- [X] Tables - PKs, FKs, Nullable and Default values
- [X] Views
- [X] User defined types like composites and enums

## Future work
- [ ] Additional export formats like entity relationship-diagrams
- [ ] Materialized views
- [ ] Support for watch-mode to rerun the tool on file change

## Development
Clone the repo, then:

```
npm install
npm run start:dev
```

## How to contribute

See our guide on [contributing](.github/CONTRIBUTING.md).

## Release History

See our [changelog](CHANGELOG.md).

## License

Copyright © 2021 Klarna Bank AB

For license details, see the [LICENSE](LICENSE) file in the root of this project.

[ci-image]: https://img.shields.io/badge/build-passing-brightgreen?style=flat-square
[ci-url]: https://github.com/klarna-incubator/TODO
[license-image]: https://img.shields.io/badge/license-Apache%202-blue?style=flat-square
[license-url]: http://www.apache.org/licenses/LICENSE-2.0
[klarna-image]: https://img.shields.io/badge/%20-Developed%20at%20Klarna-black?labelColor=ffb3c7&style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUh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