pon-task-db
v3.1.0
Published
DB task set for pon
Downloads
101
Readme
pon-task-db
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 |
``
| Param | type | Description | | ---- | --- | ----------- |
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 |
migrate(db, handlers) -> function
Define task
| Param | type | Description | | ---- | --- | ----------- | | db | function|ClayLump | DB instance or it's creator | | handlers | Object | Migration handlers |
refresh(db, options) -> function
Define task to refresh database
| Param | type | Description | | ---- | --- | ----------- | | db | function|ClayLump | DB instance or it's creator | | options | Object | Optional settings |
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.