pg-structure

Get PostgreSQL database structure as a detailed JS Object.

  • Owner: ozum/pg-structure
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

pg-structure

Reverse engineer PostgreSQL database as a detailed JS Object.

Home Page

Please see pg-structure.com for details.

IMPORTANT: If you upgrade, please see v5 breaking changes

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.

Main metrics

Overview
Name With Ownerozum/pg-structure
Primary LanguageTypeScript
Program languageJavaScript (Language Count: 4)
Platform
License:MIT License
所有者活动
Created At2014-11-05 15:08:04
Pushed At2024-05-16 05:29:54
Last Commit At2024-05-16 08:28:10
Release Count162
Last Release Namev7.15.3 (Posted on )
First Release Namev0.1.0 (Posted on 2014-11-05 18:31:53)
用户参与
Stargazers Count358
Watchers Count4
Fork Count29
Commits Count499
Has Issues Enabled
Issues Count58
Issue Open Count5
Pull Requests Count12
Pull Requests Open Count5
Pull Requests Close Count19
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private