Giter VIP home page Giter VIP logo

pg-to-dbml's Introduction

pg-to-dbml

Description

CLI tool to scan your postgres database, and output DBML.

Tech Stack

Download and install

npm install

Note to pg-to-dbml package maintenance developers

If you've cloned the pg-to-dbml repo and are working with the pg-to-dbml source code, be sure to substitute node index for pg-to-dbml when you issue terminal commands.

For example, instead of run pg-to-dbml --help, you would use node index --help.

How to use the cli

To see all the commands and options, run pg-to-dbml --help

Usage: pg-to-dbml [command] [options]

Commands:
  to-dbml  default command. connects to pg db directly and creates dbml
                    files.                                             [default]

Options:
  --version                         Show version number                [boolean]
  --help                            Show help                          [boolean]
  --connection_string, -c           database connection string for the db you
                                    want to output dbml file(s).      [required]
  --db_name, --db                   database name you want to create dbml
                                    file(s) from.                     [required]
  --exclude_schemas, -S             schema names or Postgres regexes, e.g.
                                    inventory temp_%                     [array]
  --exclude_tables, -T              table names or Postgres regexes to skip,
                                    e.g. lookup_% temporary              [array]
  --include_schemas, -s             database schema names you want to create
                                    dbml file(s) from.                   [array]
  -o, --output_path                 output dir for the resulting dbml file(s).
                                                                 [default: "./"]
  --sep, --separate_dbml_by_schema  If present, will output dbml to separate
                                    files based on schema name, e.g. schema.dbml
                                                      [boolean] [default: false]
  -t, --timeout                     how long you want process to run (in
                                    milliseconds) before it exits process.

Example Usage

Simple use case:
pg-to-dbml --c=postgresql://USER:PASSWORD@HOST:PORT -o=pathToOutput --db=DB_NAME

Fuller use case:
pg-to-dbml -c postgresql://USER:PASSWORD@HOST:PORT -o=pathToOutput --db DB_NAME -s schemaName -T skipTableA skipTableB

Linting

We are using ESLint to lint our code as we code and when we push our code. For configuring, see .eslintrc.js and .prettierrc.

Debugging

Running in debug mode in VS Code is easy. Toggle the debugger to auto-attach, and then call from the integrated terminal:

node --inspect-brk --db=DB_NAME --c=postgresql://USER:PASSWORD@HOST:PORT -o='../'

Changelog

All pull requests should include an update to the CHANGELOG that follows the existing pattern there.

Version numbers will follow Semantic Versioning.

pg-to-dbml's People

Contributors

camoore1979 avatar jeffbum avatar dbirks avatar bwortman avatar brettdavis4 avatar dependabot[bot] avatar

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.