1.7.0 • Published 5 months ago

pgtui v1.7.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

pgtui - Readable pg_dump and Terminal Interface for Postgres

pgtui is a command line interface for viewing a postgres schema or outputing a readable directory representation of a postgres schema

Installation

You can install pgtui globally like so:

npm install -g pgtui

but pgtui can also be added as a script to your package.json to help developers more easily preview your database...

npm install --save-dev pgtui
{
  "name": "my-package",
  // ...
  "scripts": {
    // ...
    "db:view": "pgtui",
    "db:dump": "pgtui --dump-to-dir ./db/structure",
  }
}

CLI Usage

pgtui <command>

Commands:
  pgtui dump-to-dir             Dump database structure into directory
  pgtui dump-typescript-models  Dump typescript models for db into directory

Options:
  --help      Show help                                                [boolean]
  --version   Show version number                                      [boolean]
  --host      Postgres Host
  --password  Postgres Password
  --user      Postgres User
  --port      Postgres Port
  --database  Postgres Database

Docker Usage

When run in docker, if a host is not provided the docker container will attempt to find the IP address of the host within docker and use it instead of localhost.

For a mac computer this is host.docker.internal, on linux it's 172.17.0.1 by default.

Dumping Database structure

To dump database structure you need to mount a volume on the host machine.

docker run -it -u "$(id -u):$(id -g)" -v $(pwd)/dump:/dump seveibar/pgtui dump-to-dir /dump

Tips

I'd also recommend adding npm run db:dump as a step after your migration, that way anyone reviewing a migration can see the change in the database structure!

Looking for a good node migration framework? Try node-pg-migrate

1.7.0

5 months ago

1.6.2

8 months ago

1.6.1

12 months ago

1.6.0

12 months ago

1.5.2

1 year ago

1.5.1

2 years ago

1.3.5

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.2.0

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.3.4

2 years ago

1.3.3

2 years ago

1.3.2

2 years ago

1.2.3

2 years ago

1.3.1

2 years ago

1.2.2

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.0

3 years ago