New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pg-doc

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-doc

Produce schema documentation for your Postgres database in markdown format

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
53
increased by381.82%
Maintainers
1
Weekly downloads
 
Created
Source

npm version

pg-doc

Produce markdown schema documentation for your Postgres database.

Installation

npm i pg-doc

or globally:

npm i -g pg-doc

Usage

Usage: pg-doc [options]

Options:
  --version                Show version number                         [boolean]
  --connection, --db       Database Connection URL           [string] [required]
  --out, -o                The file name of the output                  [string]
  --title, -t              The title of the document                    [string]
  --excluded, --ex         Tables to be excluded                         [array]
  --toc                    Add a table of contents (TOC) section
                                                       [boolean] [default: true]
  --split-by-initial, -s   Split TOC by initial letter                 [boolean]
  --split-limit, --sl      Split TOC only if number of tables is greater that
                           this limit                     [number] [default: 20]
  --no-descriptions, --nd  Don't output table/column descriptions      [boolean]
  --help                   Show help                                   [boolean]

Configuration

There are 2 alternative ways to pass configuration options appart from the command line.

Options file

You can put your options in a .pg-doc.json file in your project:

{
    "connection": <postgres connection url>,
    "excluded": <string array>,
    "noDescriptions": <boolean>,
    "toc": <boolean>,
    "splitByInitial": <boolean>,
    "splitLimit": <number>,
    "title": <string>,
    "out": <filename>
}

Environment variables

Use the following variables to pass options to pg-doc:

PGDOC_CONNECTION=<postgres connection url> 
PGDOC_OUT=<filename>
PGDOC_TITLE=<string>
PGDOC_EXCLUDED=<comma separated strings>
PGDOC_SPLIT_LIMIT=<number>
PGDOC_SPLIT_BY_INITIAL=<boolean>
PGDOC_NO_DESCRIPTIONSL=<boolean>
PGDOC_TOC=<boolean>

Precedence

Configuration options are applied in the following order (from lowest to highest precedence):

.pg-doc.json --> env variables --> command line options

Table and Column descriptions

By default pg-doc will show the description you have defined as table/column comments in your database, ie:

sql> COMMENT ON TABLE foo IS 'This is my foo table.';

will be rendered as

...

#Table NameDescription
1fooThis is my foo table.

Details

table1

This is my foo table.

...

If you have no comments defined you can either disable this by setting the noDescriptions option to true or provide your descriptions by adding a descriptions section in your .pg-doc.json file like so:

{
    "descriptions": {
        "tableName": "this is my tableName description",
        "tableName.columnName": "this is my columnName description"
    }
}

Keywords

FAQs

Package last updated on 23 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc