@ttoss/postgresdb-cli

0.1.4 • Public • Published

@ttoss/postgresdb-cli

This package provides a CLI to interact with a PostgreSQL database using the sequelize library.

Installation

pnpm add -D @ttoss/postgresdb-cli

Usage

First, you need to create define the db object in your project using the @ttoss/postgresdb package. Check @ttoss/postgresdb documentation for more information. The CLI will use this object to load the models and interact with the database.

Second, you need to define the following environment variables to connect to the database:

  • DB_NAME: database name
  • DB_USERNAME: database username
  • DB_PASSWORD: database password
  • DB_HOST: database host
  • DB_PORT: database port. Default: 5432

Sync

To sync the database schema with the models, you can use the sync command:

pnpm dlx @ttoss/postgresdb-cli sync

Options

  • --db-path or -d: Path to the file where the db object is defined. Default: ./src/db.js.
  • --alter: Alter the database schema to match the models. Default: false.

ERD (Entity-Relationship Diagram)

To generate an ERD of the database, you can use the erd command:

pnpm dlx @ttoss/postgresdb-cli erd

Options

  • --db-path or -d: Path to the file where the db object is defined. Default: ./src/db.js.

Package Sidebar

Install

npm i @ttoss/postgresdb-cli

Weekly Downloads

0

Version

0.1.4

License

MIT

Unpacked Size

7.07 kB

Total Files

6

Last publish

Collaborators

  • pedro-arantes
  • techtriangulostecnologia