Skip to content

Commit

Permalink
fix(mariadb): use json_extract when querying JSON fields
Browse files Browse the repository at this point in the history
  • Loading branch information
B4nan committed Apr 6, 2023
1 parent 369c23c commit ca96acc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/mariadb/src/MariaDbPlatform.ts
Expand Up @@ -18,10 +18,10 @@ export class MariaDbPlatform extends AbstractSqlPlatform {
const [a, ...b] = path;

if (aliased) {
return expr(alias => `${this.quoteIdentifier(`${alias}.${a}`)}->'$.${b.join('.')}'`);
return expr(alias => `json_extract(${this.quoteIdentifier(`${alias}.${a}`)}, '$.${b.join('.')}')`);
}

return `${this.quoteIdentifier(a)}->'$.${b.join('.')}'`;
return `json_extract(${this.quoteIdentifier(a)}, '$.${b.join('.')}')`;
}

getBooleanTypeDeclarationSQL(): string {
Expand Down

0 comments on commit ca96acc

Please sign in to comment.