From 3d3e4036bb78839da5fb52ebd2bc40ccdc10ca07 Mon Sep 17 00:00:00 2001 From: Kris Reeves Date: Mon, 25 Aug 2014 17:14:58 -0400 Subject: [PATCH] Compile result of .defaultsTo(null) to "default null", not "default 'null'" --- lib/schema/columncompiler.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/schema/columncompiler.js b/lib/schema/columncompiler.js index 4b69e40b..52d4fd76 100644 --- a/lib/schema/columncompiler.js +++ b/lib/schema/columncompiler.js @@ -110,6 +110,8 @@ ColumnCompiler.prototype.notNullable = function() { ColumnCompiler.prototype.defaultTo = function(value) { if (value === void 0) { return ''; + } else if (value === null) { + value = "null"; } else if (value instanceof Raw) { value = value.toQuery(); } else if (this.type === 'bool') { @@ -128,4 +130,4 @@ ColumnCompiler.prototype._num = function(val, fallback) { return isNaN(number) ? fallback : number; }; -module.exports = ColumnCompiler; \ No newline at end of file +module.exports = ColumnCompiler;