diff --git a/src/entities.js b/src/entities.js index 899657c8..cff8b67a 100644 --- a/src/entities.js +++ b/src/entities.js @@ -141,8 +141,11 @@ async function fetchEntity(entityId, type) { if (type) { queryBuilder .where('entities.type', type) - .where('entities.slug', entityId) - .orWhere(knex.raw(':entityId = ANY(entities.alias)', { entityId })); + .where((whereBuilder) => { + whereBuilder + .where('entities.slug', entityId) + .orWhere(knex.raw(':entityId = ANY(entities.alias)', { entityId })); + }); return; }