pon-task-db
DB task set for pon
Last updated 2 months ago by realglobe .
Apache-2.0 · Repository · Bugs · Original npm · Tarball
$ cnpm install pon-task-db 
SYNC missed versions from official npm registry.

pon-task-db

Build Status npm Version JS Standard

DB task set for pon

Installation

$ npm install pon-task-db --save

Usage

'use strict'

const pon = require('pon')
const {setup, seed, dump, migrate} = require('pon-task-db')

async function tryExample () {
  const createDB = () => {/*...*/}

  const run = pon({
    'db:setup': setup(createDB),
    'db:seed': seed(createDB, 'db/seeds/:env/*.seed.json')
  })

  run('db:seed')
}

tryExample()

Signatures

define(options) -> function

Define task

Param type Description
options Object Optional settings

drop(db, options) -> function

Define task to drop database

Param type Description
db function|ClayLump DB instance or it's creator
options Object Optional settings
options.unless string NODE_ENV to skip

dump(db, dirname, options) -> function

Define task to dump database

Param type Description
db function|ClayLump DB instance or it's creator
dirname string Dirname to save dump
options Object Optional settings
options.max number Rotation max count

exec(db, options) -> function

Define task to exec database

Param type Description
db function|ClayLump DB instance or it's creator
options Object Optional settings

exp(db, dirname) -> function

Param type Description
db function|ClayLump DB instance or it's creator
dirname string Dirname export from

imp(db, dirname) -> function

Param type Description
db function|ClayLump DB instance or it's creator
dirname string Dirname import from

load(db, options) -> function

Define task to load file into database

Param type Description
db function|ClayLump DB instance or it's creator
options Object Optional settings

migrate(db, handlers) -> function

Define task

Param type Description
db function|ClayLump DB instance or it's creator
handlers Object Migration handlers

setup(db, options) -> function

Define task to setup database

Param type Description
db function|ClayLump DB instance or it's creator
options Object Optional settings

License

This software is released under the Apache-2.0 License.

Links

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 40
Dependencies (6)
Dev Dependencies (16)
Dependents (2)

Copyright 2014 - 2017 © taobao.org |