From 18338bca9362e30558431753947a3ca53aea782c Mon Sep 17 00:00:00 2001 From: Tobias Gurtzick Date: Mon, 11 Feb 2019 13:38:53 +0100 Subject: [PATCH] fix(bug): check for defaultValue existence first Signed-off-by: Tobias Gurtzick --- index.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 2a261bf..34ce03c 100644 --- a/index.js +++ b/index.js @@ -43,10 +43,17 @@ var Base = Class.extend({ }, _prepareSpec: function(columnName, spec, options, tableName) { - if (spec.defaultValue.raw) { - spec.defaultValue.prep = spec.defaultValue.raw; - } else if (spec.defaultValue.special) { - this._translateSpecialDefaultValues(spec, options, tableName, columnName); + if (spec.defaultValue) { + if (spec.defaultValue.raw) { + spec.defaultValue.prep = spec.defaultValue.raw; + } else if (spec.defaultValue.special) { + this._translateSpecialDefaultValues( + spec, + options, + tableName, + columnName + ); + } } },