manage-database
Advanced tools
Comparing version 0.1.4 to 0.2.0
'use strict'; | ||
var join = require('path').join; | ||
var P = require('bluebird'); | ||
@@ -16,3 +17,4 @@ var DIALECTS = ['postgres', 'mysql']; | ||
provider = require('./' + join('lib', dialect)); | ||
return provider(opts); | ||
return P.promisifyAll(provider(opts)); | ||
}; |
@@ -25,5 +25,5 @@ 'use strict'; | ||
drop: function (name, done) { | ||
execute(fmt('DROP DATABASE IF EXISTS %s;', name), opts, done); | ||
execute(fmt('DROP DATABASE IF EXISTS `%s`;', name), opts, done); | ||
} | ||
}; | ||
}; |
@@ -7,3 +7,3 @@ 'use strict'; | ||
function execute(query, opts, done) { | ||
pg.connect(opts, function(err, client) { | ||
pg.connect(opts, function (err, client) { | ||
if (err) { | ||
@@ -14,3 +14,3 @@ pg.end(); | ||
return client.query(query, function(err) { | ||
return client.query(query, function (err) { | ||
client.end(); | ||
@@ -17,0 +17,0 @@ done(err); |
{ | ||
"name": "manage-database", | ||
"version": "0.1.4", | ||
"version": "0.2.0", | ||
"description": "Manage databases", | ||
@@ -15,2 +15,6 @@ "main": "index.js", | ||
], | ||
"scripts": { | ||
"lint": "eslint ./lib index.js", | ||
"lint:fix": "eslint --fix ./lib index.js" | ||
}, | ||
"author": "Maxim Malov <m.malov.v@gmail.com>", | ||
@@ -23,6 +27,9 @@ "license": "The MIT License (MIT)", | ||
"devDependencies": { | ||
"gulp": "^3.8.9", | ||
"gulp-jshint": "^1.8.5", | ||
"jshint-stylish": "^1.0.0" | ||
"eslint": "^2.1.0" | ||
}, | ||
"dependencies": { | ||
"bluebird": "^3.3.1", | ||
"mysql": "^2.10.2", | ||
"pg": "^4.4.6" | ||
} | ||
} |
@@ -34,2 +34,11 @@ Manage databases with NodeJS | ||
// or promisified version | ||
dbMgr.createAsync('database_name') | ||
.then(function () { | ||
console.log('database created'); | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}); | ||
// drop database | ||
@@ -45,2 +54,11 @@ dbMgr.drop('database_name', function (err) { | ||
// or promisified version | ||
dbMgr.dropAsync('database_name') | ||
.then(function () { | ||
console.log('database deleted'); | ||
}) | ||
.catch(function (err) { | ||
console.error(err); | ||
}); | ||
### Options | ||
@@ -47,0 +65,0 @@ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6257
1
75
107
0
3
8
+ Addedbluebird@^3.3.1
+ Addedmysql@^2.10.2
+ Addedpg@^4.4.6
+ Addedbignumber.js@9.0.0(transitive)
+ Addedbluebird@3.7.2(transitive)
+ Addedbuffer-writer@1.0.1(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedgeneric-pool@2.4.2(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedjs-string-escape@1.0.1(transitive)
+ Addedmysql@2.18.1(transitive)
+ Addedpacket-reader@0.2.0(transitive)
+ Addedpg@4.5.7(transitive)
+ Addedpg-connection-string@0.1.3(transitive)
+ Addedpg-int8@1.0.1(transitive)
+ Addedpg-types@1.13.0(transitive)
+ Addedpgpass@0.0.3(transitive)
+ Addedpostgres-array@1.0.3(transitive)
+ Addedpostgres-bytea@1.0.0(transitive)
+ Addedpostgres-date@1.0.7(transitive)
+ Addedpostgres-interval@1.2.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.7(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsemver@4.3.6(transitive)
+ Addedsplit@0.3.3(transitive)
+ Addedsqlstring@2.3.1(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedxtend@4.0.2(transitive)