Giter VIP home page Giter VIP logo

postgres-markdown's Introduction

Postgres Markdown

Builds markdown from a Postgres connection

Installation:

npm install -g postgres-markdown

Usage:

Usage: postgres-markdown [options]

Options:
  -V, --version              output the version number
  -H, --host [host]          Host (default: "127.0.0.1")
  -p, --port [port]          Port (default: 5432)
  -u, --user [user]          User (default: "postgres")
  -W, --password [password]  Password
  -d, --database [database]  Database (default: "postgres")
  -o, --output [output]      Output file name (default: "index.md")
  -l, --locale [locale]      Locale (default: "ru")
  -i, --ignore <ignore>      Pattern of objects to ignore
  -v, --verbose              Verbose output
  -h, --help                 output usage information

Example DB:

CREATE SCHEMA users;
COMMENT ON SCHEMA users
  IS 'Пользователи';
  
CREATE TABLE users."user"
(
  id serial NOT NULL,
  email character varying(100) NOT NULL,
  CONSTRAINT user_pkey PRIMARY KEY (id),
  CONSTRAINT user_email_key UNIQUE (email)
);

COMMENT ON COLUMN users."user".email IS 'Уникальный email пользователя (логин)';

CREATE TYPE web_users.test_enum AS ENUM
   ('NEW',
    'CLOSED');

CREATE TABLE web_users."user"
(
  settings integer[],
  status web_users.test_enum,
  CONSTRAINT user_pkey PRIMARY KEY (id)
)
INHERITS (users."user");

COMMENT ON COLUMN web_users."user".settings IS 'Массив int флагов';

COMMENT ON COLUMN web_users."user".status IS 'Статус пользователя
NEW - новый, CLOSED - закрытый

Статусы указаны для примера';

Example output:

Database Documentation

Created at: 2019-09-08T14:32:51.401Z Server version: PostgreSQL 10.10, compiled by Visual C++ build 1800, 64-bit

Schema: users

Tables

users.user

Inherited tables:

column comment type length default constraints values
id (pk) integer nextval('users.user_id_seq'::regclass) NOT NULL
email Уникальный email пользователя (логин) character varying 100 NOT NULL

Schema: web_users

Tables

web_users.user

column comment type length default constraints values
id (pk) integer nextval('users.user_id_seq'::regclass) NOT NULL
email inherits from users.user Уникальный email пользователя (логин) character varying 100 NOT NULL
settings Массив int флагов integer[]
status Статус пользователя NEW - новый, CLOSED - закрытый Статусы указаны для примера user-defined NEW, CLOSED

postgres-markdown's People

Contributors

dependabot[bot] avatar ilyaplot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

postgres-markdown's Issues

Foreign keys an unique constraints

Feature Request:

Thanks for this useful tool!

I'd love for the output to also show foreign keys and unique constraints. I may contribute this myself but you can certainly implement it faster.

Anchor links with "."

Anchor links are auto-generated by substituting "." with a "-" (e.g. #### schema.table is referenced as (#schema-table).
In gitlab, a "." in a headline is simply left out in the anchor. So for me, the link then has to look like this (#schematable).

Output values of single column enum tables

Love this tool!
I saw, that enums are automatically added to the "values" column, which is great.
Due to some downstream services contraints, I had to move from enum data types to single column reference tables.
Is there a way to print out the rows of a table as well?

I execute the command, nothing happened

i try

postgres-markdown -H "192.168.2.23" -p 30002 -u "postgres" -W "olxin88" -l "en"

and

postgres-markdown -H 192.168.2.23 -p 30002 -u postgres -W olxin88 -l en -o my.md

nothing happens, even output file or error messages, can you give me some suggestions? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.