CLI tool to scan your postgres database, and output DBML.
npm install pg-to-dbmlnpm install
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.
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.
`
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
We are using ESLint to lint our code as we code and when we push our code. For configuring, see .eslintrc.js and .prettierrc.
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='../'
All pull requests should include an update to the CHANGELOG that follows the existing pattern there.
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 numberdocs/changelogs
- Move the changelog to the directory, and start a new one from a templatepackage.json
- Version bump the and package-lock.jsonmain`
- Commit, tag, and push the results to
- Publish the package to Github Packages and NPM
- And create a Github Release