Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ttoss/postgresdb-cli

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ttoss/postgresdb-cli

A library to handle PostgreSQL database actions through the command line

Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
186
-40.76%
Maintainers
2
Weekly downloads
 
Created
Source

@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.

Keywords

database

FAQs

Package last updated on 26 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts