From 1e19c1465a813a4bbfe672d4372df1f454c45b6c Mon Sep 17 00:00:00 2001 From: loay Date: Tue, 14 Mar 2017 21:54:03 -0400 Subject: [PATCH] Fix no order exists bug --- lib/sql.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/sql.js b/lib/sql.js index af15616..d41baa5 100644 --- a/lib/sql.js +++ b/lib/sql.js @@ -1159,8 +1159,9 @@ SQLConnector.prototype._buildWhere = function(model, where) { * @returns {string} The ORDER BY clause */ SQLConnector.prototype.buildOrderBy = function(model, order) { + var idName = this.idName(model); if (!order) { - return ''; + order = idName; } var self = this; if (typeof order === 'string') {