Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pg-validator

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-validator

postgresql database schema validation and creation utility

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

pg-validator

Simple PostgreSQL database schema validation and creation.

#Overview

An alternative to using sql files to ensure a specific schema

Takes a yaml file as input and does a drop validate create in that order, depending on command line flags.

#Installation

TODO: NPM

#Usage

Usage: pg_validate [options]

Options:

-h, --help                      output usage information
-V, --version                   output the version number
-f, --file [file name]          schema definition file
-h, --host [host name]          postgresql host name or ip
-u, --user [user name]          postgresql user name
-p, --password [user password]  postgresql password
-z, --validate                  validate schema
-d,  --drop                     drop schema tables
-c, --create                    create schema

#Configuration files

Configuration files should be made one per database, consider the simple.yaml example:

---
#####
#An example db specification
#####
db_name : testdb
tables :
  neighbors :
    columns :
      id : increments
      name : string
      address :
        type : string
        unique : true
      spouse_name : 
        type : string
        defaultTo : No Spouse
    primary_key : id

While relatively straightforward, pg-validator is a simple wrapper around the Knex module. Database columns are either simple a string, denoting the type, or an object.

Columns that are defined as objects are required to have a type. Other parameters must follow the Knex schema definition functions for columns. In case the knex function does not have any parameters, the boolean value true should be used. This is demonstrated in the example above with the column spouse_name.

#License

MIT

Keywords

FAQs

Package last updated on 11 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc