Browse Source

fix: cast uuid in custom knex

Signed-off-by: Wing-Kam Wong <wingkwong.code@gmail.com>
pull/1156/head
Wing-Kam Wong 3 years ago
parent
commit
0778406981
  1. 15
      packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts

15
packages/nocodb/src/lib/dataMapper/lib/sql/CustomKnex.ts

@ -430,11 +430,19 @@ const appendWhereCondition = function(
);
break;
case '':
const column = (columnAliases[matches[2]] || matches[2]);
const operator = opMapping[matches[3]];
const target = matches[4];
if (matches[3] == 'like') {
// handle uuid case
knexRef[`${key}`](
columnAliases[matches[2]] || matches[2],
opMapping[matches[3]],
matches[4]
knexRef?.client.raw(`??::TEXT ${operator} '${target}'`, [
column
])
);
} else {
knexRef[`${key}`](column, operator, target);
}
break;
default:
throw new Error(`${matches[1] || ''} Invalid operation.`);
@ -991,6 +999,7 @@ export { Knex };
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

Loading…
Cancel
Save