knex-utils
Advanced tools
Comparing version 4.1.3 to 4.1.4
@@ -12,11 +12,16 @@ const validate = require('validation-utils'); | ||
*/ | ||
function cleanDb(knex, tableNames, logger) { | ||
function cleanDb(knex, tableNames, logger, verboseLog = false) { | ||
validate.notNil(tableNames); | ||
logger = logger || console; | ||
return tableCleaner | ||
.cleanTables(knex, tableNames) | ||
.then(() => logger.info('Tables cleaned successfully: ', tableNames.join(', '))) | ||
.cleanTables(knex, tableNames, verboseLog) | ||
.then(() => { | ||
if (logger) { | ||
logger.info('Tables cleaned successfully: ', tableNames.join(', ')); | ||
} | ||
}) | ||
.catch(err => { | ||
logger.error('Error cleaning tables', err); | ||
if (logger) { | ||
logger.error('Error cleaning tables', err); | ||
} | ||
throw err; | ||
@@ -23,0 +28,0 @@ }); |
{ | ||
"name": "knex-utils", | ||
"version": "4.1.3", | ||
"version": "4.1.4", | ||
"description": "knex.js utils", | ||
"main": "src/index.js", | ||
"scripts": { | ||
"lint": "eslint .", | ||
"prettier": "prettier --write \"{lib,test}/**/*.{js,ts}\"", | ||
"lint": "eslint --format codeframe \"lib/**/*.js\" \"test/**/*.js\"", | ||
"lint-to-console": "eslint .", | ||
"test": "mocha --opts \"./mocha.opts\" test/**/*.spec.js", | ||
"test-coverage": "nyc npm test" | ||
"test-coverage": "nyc npm test", | ||
"test-travis": "npm run lint && nyc mocha --opts \"./mocha.opts\" test" | ||
}, | ||
@@ -30,4 +30,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"knex-tablecleaner": "^3.0.1", | ||
"validation-utils": "^2.3.0" | ||
"knex-tablecleaner": "^3.1.0", | ||
"validation-utils": "^2.8.0" | ||
}, | ||
@@ -38,10 +38,11 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"eslint": "^4.19.1", | ||
"eslint-plugin-prettier": "^2.6.0", | ||
"knex": "^0.14.6", | ||
"mocha": "^5.1.1", | ||
"nyc": "^11.7.1", | ||
"prettier": "^1.12.1", | ||
"sinon": "^5.0.1" | ||
"chai": "^4.2.0", | ||
"eslint": "^5.7.0", | ||
"eslint-config-prettier": "^3.1.0", | ||
"eslint-plugin-prettier": "^3.0.0", | ||
"knex": "^0.15.2", | ||
"mocha": "^5.2.0", | ||
"nyc": "^13.1.0", | ||
"prettier": "^1.14.3", | ||
"sinon": "^7.1.0" | ||
}, | ||
@@ -51,16 +52,15 @@ "nyc": { | ||
"include": [ | ||
"src/**" | ||
"lib/**" | ||
], | ||
"reporter": [ | ||
"html" | ||
"text" | ||
], | ||
"cache": true, | ||
"all": true, | ||
"report-dir": "./build/reports/coverage", | ||
"check-coverage": true, | ||
"lines": 50, | ||
"statements": 50, | ||
"functions": 66, | ||
"branches": 33 | ||
"lines": 66, | ||
"statements": 66, | ||
"functions": 60, | ||
"branches": 45 | ||
} | ||
} |
@@ -5,2 +5,6 @@ # Knex Utils | ||
[![NPM Version][npm-image]][npm-url] | ||
[![NPM Downloads][downloads-image]][downloads-url] | ||
[![Linux Build][travis-image]][travis-url] | ||
** Connection init example | ||
@@ -83,1 +87,8 @@ | ||
``` | ||
[npm-image]: https://img.shields.io/npm/v/knex-utils.svg | ||
[npm-url]: https://npmjs.org/package/knex-utils | ||
[downloads-image]: https://img.shields.io/npm/dm/knex-utils.svg | ||
[downloads-url]: https://npmjs.org/package/knex-utils | ||
[travis-image]: https://img.shields.io/travis/kibertoad/knex-utils/master.svg?label=linux | ||
[travis-url]: https://travis-ci.org/kibertoad/knex-utils |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
12067
232
93
9
10
Updatedknex-tablecleaner@^3.1.0
Updatedvalidation-utils@^2.8.0