Socket
Socket
Sign inDemoInstall

db-migrate

Package Overview
Dependencies
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

db-migrate - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

6

CHANGELOG.md

@@ -19,1 +19,7 @@ ## 0.1.0

- Fix renameTable method for PostgreSQL #15 (via Roman Ostolosh)
## 0.1.3
Fix:
- Respect column length specification on column defs #16 (via Matt Huggins)
- Allow default environment to be dev or development #17 (via Matt Huggins)

20

lib/config.js

@@ -28,3 +28,3 @@ var fs = require('fs');

} else {
setCurrent('dev');
setCurrent(['dev', 'development']);
}

@@ -36,13 +36,15 @@

var setCurrent = exports.setCurrent = function(env) {
var current = env;
if (dbmUtil.isString(env)) {
if(!exports[env]) {
throw new Error("Environment '" + env + "' not found.");
env = dbmUtil.isArray(env) ? env : [env];
env.forEach(function (current) {
if (dbmUtil.isString(current) && exports[current]) {
exports.getCurrent = function() {
return exports[current];
}
}
var current = exports[env];
}
});
exports.getCurrent = function() {
return current;
if (!exports.getCurrent) {
throw new Error("Environment(s) '" + env.join(', ') + "' not found.");
}
}

@@ -39,3 +39,6 @@ var util = require('util');

createColumnDef: function(name, spec, options) {
return [name, this.mapDataType(spec.type), this.createColumnConstraint(spec, options)].join(' ');
var type = this.mapDataType(spec.type);
var len = spec.length ? util.format('(%s)', spec.length) : '';
var constraint = this.createColumnConstraint(spec, options);
return [name, type, len, constraint].join(' ');
},

@@ -42,0 +45,0 @@

@@ -14,2 +14,3 @@ var util = require('util');

},
startMigration: function(cb){

@@ -24,4 +25,8 @@ this.runSql('BEGIN;', function() { cb()});

createColumnDef: function(name, spec, options) {
return [name, spec.autoIncrement ? '' : this.mapDataType(spec.type), this.createColumnConstraint(spec, options)].join(' ');
var type = spec.autoIncrement ? '' : this.mapDataType(spec.type);
var len = spec.length ? util.format('(%s)', spec.length) : '';
var constraint = this.createColumnConstraint(spec, options);
return [name, type, len, constraint].join(' ');
},
mapDataType: function(str) {

@@ -28,0 +33,0 @@ switch(str) {

@@ -26,8 +26,12 @@ exports.lpad = function(str, padChar, totalLength) {

exports.isArray = function(obj) {
return Object.prototype.toString.call(obj) == '[object Array]';
};
exports.isFunction = function(obj) {
return typeof(obj) == 'function';
}
};
exports.isString = function(obj) {
return typeof(obj) == 'string';
}
};

@@ -7,3 +7,3 @@ {

"keywords": ["database", "db", "migrate", "migration", "sqlite", "mysql"],
"version": "0.1.2",
"version": "0.1.3",
"engines": { "node" : ">=0.6.0" },

@@ -10,0 +10,0 @@ "maintainers": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc