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; break;
case '': 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}`]( knexRef[`${key}`](
columnAliases[matches[2]] || matches[2], knexRef?.client.raw(`??::TEXT ${operator} '${target}'`, [
opMapping[matches[3]], column
matches[4] ])
); );
} else {
knexRef[`${key}`](column, operator, target);
}
break; break;
default: default:
throw new Error(`${matches[1] || ''} Invalid operation.`); throw new Error(`${matches[1] || ''} Invalid operation.`);
@ -991,6 +999,7 @@ export { Knex };
* *
* @author Naveen MR <oof1lab@gmail.com> * @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@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 * @license GNU AGPL version 3 or any later version
* *

Loading…
Cancel
Save