db-migrate
Advanced tools
Comparing version 0.6.3 to 0.6.4
@@ -203,1 +203,14 @@ ## 0.1.0 | ||
- Fix postgres issue with camelCased column name during insert #137 (via @tone81) | ||
## 0.6.4 | ||
Improvement: | ||
- Handle more than one single quote in string literals in a portable way #151 (via @szywon) | ||
- added date, char and smallint types for pg #150 (via @FabricioFFC) | ||
- better error handling for broken database.json files #149 (via @acruikshank) | ||
Fix: | ||
- Make compatible with coffee-script 1.7 #147 (via @jinze) | ||
- docs: the exports.down fn gets (db, callback) as params #144 (via @alxndr) | ||
- Fix for multiple single quotes in a string #143 | ||
@@ -17,2 +17,7 @@ var fs = require('fs'); | ||
} catch(e) { | ||
// distinguish broken files from missing ones | ||
if (e instanceof SyntaxError){ | ||
throw e; | ||
} | ||
config = require(path.join(process.cwd(), fileName)); | ||
@@ -19,0 +24,0 @@ } |
module.exports = { | ||
CHAR: 'char', | ||
STRING: 'string', | ||
TEXT: 'text', | ||
SMALLINT: 'smallint', | ||
INTEGER: 'int', | ||
BIG_INTEGER: 'bigint', | ||
REAL: 'real', | ||
DATE: 'date', | ||
DATE_TIME: 'datetime', | ||
@@ -8,0 +11,0 @@ TIME: 'time', |
@@ -43,2 +43,8 @@ var util = require('util'); | ||
return 'DECIMAL'; | ||
case type.CHAR: | ||
return 'CHAR'; | ||
case type.DATE: | ||
return 'DATE'; | ||
case type.SMALLINT: | ||
return 'SMALLINT'; | ||
default: | ||
@@ -178,3 +184,3 @@ var unknownType = str.toUpperCase(); | ||
if (typeof(valueArray[index]) === 'string') { | ||
values += "'" + valueArray[index].replace("'", "''") + "'"; | ||
values += "'" + this.escape(valueArray[index]) + "'"; | ||
} else { | ||
@@ -231,4 +237,4 @@ values += valueArray[index]; | ||
escape: function(str) { | ||
return str.replace(/'/g, "\'"); | ||
return str.replace(/'/g, "''"); | ||
} | ||
}); |
@@ -189,3 +189,3 @@ var util = require('util'); | ||
if (typeof(valueArray[index]) === 'string') { | ||
values += "'" + valueArray[index].replace("'", "''") + "'"; | ||
values += "'" + this.escape(valueArray[index]) + "'"; | ||
} else { | ||
@@ -192,0 +192,0 @@ values += valueArray[index]; |
@@ -1,6 +0,26 @@ | ||
exports.info = console.info.bind(console, '[INFO]'); | ||
exports.warn = console.warn.bind(console, '[WARN]'); | ||
exports.error = console.error.bind(console, '[ERROR]'); | ||
this.isSilent = false | ||
exports.silence = function (isSilent) { | ||
return this.isSilent = isSilent; | ||
}; | ||
exports.info = function () { | ||
if (!this.isSilent || global.verbose) { | ||
Array.prototype.unshift.call(arguments, '[INFO]'); | ||
console.info.apply(console, arguments); | ||
} | ||
}; | ||
exports.warn = function () { | ||
if (!this.isSilent || global.verbose) { | ||
var args = Array.prototype.unshift.call(arguments, '[WARN]'); | ||
console.warn.apply(console, arguments); | ||
} | ||
}; | ||
exports.error = function () { | ||
if (!this.isSilent || global.verbose) { | ||
var args = Array.prototype.unshift.call(arguments, '[ERROR]'); | ||
console.error.apply(console, arguments); | ||
} | ||
}; | ||
exports.sql = function(sql) { | ||
if (global.dryRun || global.verbose) { | ||
if (!this.isSilent && (global.dryRun || global.verbose)) { | ||
var args = Array.prototype.slice.call(arguments).slice(1); | ||
@@ -26,4 +46,5 @@ args = args.slice(0, args.length - 1); | ||
if (global.verbose) { | ||
console.log.bind(console, '[INFO]').apply(console, arguments); | ||
Array.prototype.unshift.call(arguments, '[INFO]'); | ||
console.log.apply(console, arguments); | ||
} | ||
}; |
@@ -10,4 +10,6 @@ var fs = require('fs'); | ||
var coffeeSupported = false; | ||
var coffeeModule = null; | ||
try { | ||
require('coffee-script'); | ||
coffeeModule = require('coffee-script'); | ||
if (coffeeModule && coffeeModule.register) coffeeModule.register(); | ||
coffeeSupported = true; | ||
@@ -14,0 +16,0 @@ filesRegEx = /\.(js|coffee)$/; |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"engines": { | ||
@@ -17,0 +17,0 @@ "node": ">=0.6.0" |
@@ -39,3 +39,3 @@ # db-migrate | ||
exports.down = function (callback) { | ||
exports.down = function (db, callback) { | ||
callback(); | ||
@@ -42,0 +42,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1706
86148
24