Skip to content

Commit

Permalink
Removing regex (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
dolezel authored Feb 20, 2018
1 parent aa04280 commit 07ba543
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/operations/indexes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ function generateIndexName(table, columns, options) {
}

function generateColumnString(column) {
return /.+\(.*\)/.test(column)
const openingBracketPos = column.indexOf('(');
const closingBracketPos = column.indexOf(')');
const isFunction = openingBracketPos >= 0 && closingBracketPos > openingBracketPos;
return isFunction
? column // expression
: template`"${column}"`; // single column
}
Expand Down

0 comments on commit 07ba543

Please sign in to comment.