Nukem's Possible Manifestation

    extract-pg-schema
    TypeScript icon, indicating that this package has built-in type declarations

    4.0.2 • Public • Published

    Extract Schema from Postgres Database

    Reads various metadata from your postgres database and return a Javascript object. This package is used by Kanel to generate Typescript types and Schemalint to provide linting of database schemas.

    View the documentation here

    Installation

    npm i extract-pg-schema

    Usage

    You give it a postgres connection config object and some options and it will connect to your database and generate

    const { extractSchemas } = require('extract-pg-schema');
    
    async function run() {
      const connection = {
        host: 'localhost',
        database: 'postgres',
        user: 'postgres',
        password: 'postgres',
      };
    
      const result = await extractSchemas(connection);
    
      console.log(result);
    }
    
    run();

    For an example of a generated object, take a look at dvdrental.json file which is generated from the sample Database from PostgreSQLTutorial.com.


    Contributors

    Made with contrib.rocks.

    Install

    npm i extract-pg-schema

    DownloadsWeekly Downloads

    37,397

    Version

    4.0.2

    License

    MIT

    Unpacked Size

    308 kB

    Total Files

    100

    Last publish

    Collaborators

    • kristiandupont