0.13.7 • Published 9 years ago

pg-json-schema-export v0.13.7

Weekly downloads
131
License
MIT
Repository
github
Last release
9 years ago

pg-json-schema-export

NPM version Build status Dependency Status

Export a Postgres schema as JSON

Install

$ npm install pg-json-schema-export --save

Usage

var PostgresSchema = require('pg-json-schema-export');
var connection =
  user: 'postgres',
  password: '123',
  host: 'localhost',
  port: 5432,
  database: 'thedb'
};
PostgresSchema.toJSON(connection, 'public')
  .then(function (schemas) {
    // handle json object
  })
  .catch(function (error) {
    // handle error
  });

Output Format

The output format is for the most part named after the columns in information_schema.

Structure

  • schemas
    • views
      • columns
    • tables
      • columns
    • sequences

JSON

{
  "tables": {
    "user": {
      "obj_description": "This table has Users in it",
      "columns": {
        "name": {
          "data_type": "text",
          // ... more columns
        }
      }
    },
    // ... more tables
  },
  "constraints": {
    // column constraints, grouped by table
  },
  "sequences": {
    // column sequences, grouped by table
  }

I auto-generate some JSON during each CI build; those are uploaded as Github releases: https://github.com/tjwebb/pg-json-schema-export/releases/latest

API

.toJSON(connection, schema)

parameterdescription
connectionconnection string or object compatible with pg
schemathe database schema to export

License

MIT

0.13.7

9 years ago

0.13.6

9 years ago

0.13.5

10 years ago

0.13.3

10 years ago

0.13.2

10 years ago

0.13.1

10 years ago

0.13.0

10 years ago

0.12.2

10 years ago

0.12.1

10 years ago

0.12.0

10 years ago

0.11.6

10 years ago

0.11.5

10 years ago

0.11.4

10 years ago

0.11.2

10 years ago

0.11.3

10 years ago

0.11.1

10 years ago

0.11.0

10 years ago

0.10.3

10 years ago

0.10.2

10 years ago

0.10.1

10 years ago

0.10.0

10 years ago

0.9.2

10 years ago

0.9.1

10 years ago

0.9.0

10 years ago

0.0.1

10 years ago