DB task set for pon
$ npm install pon-task-db --save
'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()
Define task
Param | type | Description |
---|---|---|
options | Object | Optional settings |
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 |
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 |
Define task to exec database
Param | type | Description |
---|---|---|
db | function|ClayLump | DB instance or it's creator |
options | Object | Optional settings |
Define task
Param | type | Description |
---|---|---|
db | function|ClayLump | DB instance or it's creator |
handlers | Object | Migration handlers |
Define task to refresh database
Param | type | Description |
---|---|---|
db | function|ClayLump | DB instance or it's creator |
options | Object | Optional settings |
Define task to setup database
Param | type | Description |
---|---|---|
db | function|ClayLump | DB instance or it's creator |
options | Object | Optional settings |
This software is released under the Apache-2.0 License.