npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pg-to-dbml-papandreou

v0.3.7-patch10

Published

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

Downloads

13

Readme

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.

Making a Pull Request

When making a pull request, label the PR with the type of semver version bump you wish to make (major, minor, or patch), and Github Actions will take care of the whole release process. It will:

  • Substitute x.x.x in the changelog with the new version number
  • Move the changelog to the docs/changelogs directory, and start a new one from a template
  • Version bump the package.json and package-lock.json
  • Commit, tag, and push the results to main
  • Publish the package to Github Packages and NPM
  • And create a Github Release