You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

db3-config

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

db3-config

Db3 config is a tool for syncing SQL database structure with JSON config.

1.3.0
latest
Source
npmnpm
Version published
Weekly downloads
89
323.81%
Maintainers
1
Weekly downloads
 
Created
Source

Db3 config is a tool for syncing SQL database structure with JSON config.

Why do I need it?

To store your database structure as JSON and sync it with real database.

Init

var db = require('db3').connect()
var db3Config = require('db3-config')(db)

.pull(done)

Reads data from db into JSON.

db3Config.pull(function (err, data) {
  console.log(data) //outputs JSON config
})

.diff(config, done)

Calculates diff

db3Config.diff(config, function (err, data) {
  //data is diff
})

.push(diff, done)

Apply diff to the db

db3Config.push(diff, function (err) {})

Config format

{
  "table": {
    "user": {
      "field": {
        "id": true, //will be bigint primary key, auto_increment
        "username": "text",
        "password": "varchar(32)",
        "subscribed": {
          "dataType": "tinyint",
          "default": 0
        }
      },
      "key": {
        "subscribed": true
      }
    }
  }
}

FAQs

Package last updated on 08 Jan 2017

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