Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

pg-structure

6.2.0 • Public • Published

pg-structure

Reverse engineer PostgreSQL database as a detailed JS Object.

Home Page

Please see pg-structure.com for details.

Installation

$ npm install pg-structure

Synopsis

import pgStructure from "pg-structure";
 
async function demo() {
  const db = await pgStructure({ database: "db", user: "u", password: "pass" }, { includeSchemas: ["public"] });
 
  const table = db.get("contact");
  const columnNames = table.columns.map((c) => c.name);
  const columnTypeName = table.columns.get("options").type.name;
  const indexColumnNames = table.indexes.get("ix_mail").columns;
  const relatedTables = table.hasManyTables;
}

Details

pg-structure reverse engineers PostgreSQL database and lets you easily code, analyze, operate on PostgreSQL database structure by providing details about DB, Schema, Table, Column, ForeignKey, Relation, Index, Type and others.

Keywords

none

Install

npm i pg-structure

DownloadsWeekly Downloads

1,099

Version

6.2.0

License

MIT

Unpacked Size

539 kB

Total Files

196

Last publish

Collaborators

  • avatar