Add condition for postgres and oracle

This commit is contained in:
loay 2017-04-21 16:11:05 -04:00
parent 8355d803d4
commit 2b443c7723
1 changed files with 6 additions and 1 deletions

View File

@ -1185,8 +1185,13 @@ SQLConnector.prototype.buildOrderBy = function(model, order) {
return '';
}
var self = this;
var usedConnector = this.dataSource.connector.name;
if (order === 'rand') {
return 'ORDER BY RAND()';
if (usedConnector === 'mysql') {
return 'ORDER BY RAND()';
} else if (usedConnector === 'postgres' || usedConnector === 'oracle') {
return 'ORDER BY RANDOM()';
}
} else {
if (typeof order === 'string') {
order = [order];