# Introduction

pg-structure is a Node.js library written in TypeScript to reverse engineer PostgreSQL (opens new window) database as a detailed JavaScript object.

Use pgStructure() function to get root Db object. It also provides some additional useful objects which are not present in RDMS such as one to many, many to one and many to many relations.

Created object can be used to auto generate documentation or ORM models from database. It is much easier to work with JS object than working manually with database and SQL queries.

# Features

  • Fully tested
  • Fully documented
  • All PostgreSQL data types including array, JSON and HSTore
  • Support composite keys (Multiple field keys)
  • Schema support
  • Constraints (Primary Key, Foreign Key, Unique etc.).
  • Supports multi-column constraints.
  • Identifies one to many (hasMany) relationships.
  • Identifies reverse of one to many (belongsTo) relationships
  • Identifies all possible many to many (belongs to many & has many through) relationships
  • Objects can be accessed by name or by order.
  • Allows to store and extract JSON data from Database objects. (See Description Data in concepts.)
  • Very detailed column meta data such as not null, description, auto increment, onUpdate, onDelete, etc. See Column doc for details.

# Where to Start?

# Contributions

# Thanks for Contributions

PhilWaldmann (opens new window) ShaunParsons (opens new window) cyberinferno (opens new window) viniciuspinto (opens new window)