8425 - stop using v2 category tables and views (#190)
Add new relic deployment marker / New Relic (push) Has been cancelled
Node.js CI with tests / build (16.x) (push) Has been cancelled
Sync staging from master / build (push) Has been cancelled

This commit is contained in:
Anders Gustafsson
2026-06-16 14:11:02 +02:00
committed by GitHub
parent eecc0f4f1b
commit 8608b28300
+5 -5
View File
@@ -82,7 +82,7 @@ WHERE product_category.product_id = ?
SELECT product_category.category_id as id, SELECT product_category.category_id as id,
categories.* categories.*
FROM product_category FROM product_category
JOIN v_categorytree_v2 categories ON product_category.category_id = categories.id JOIN v_categorytree categories ON product_category.category_id = categories.id
WHERE product_category.product_id = ? WHERE product_category.product_id = ?
`; `;
@@ -101,7 +101,7 @@ WHERE product_category.product_id = ?
const { rows } = await this.cachedRaw( const { rows } = await this.cachedRaw(
/* sql */ ` /* sql */ `
SELECT id SELECT id
FROM v_categorytree_v2 FROM v_categorytree
WHERE depth = 1 WHERE depth = 1
AND id NOT IN (${createQuestionMarksFromList(KNOWN_FACET_PARENT_IDS)}) AND id NOT IN (${createQuestionMarksFromList(KNOWN_FACET_PARENT_IDS)})
`, `,
@@ -139,7 +139,7 @@ WHERE product_category.product_id = ?
WHEN id = ? THEN 'pattern' WHEN id = ? THEN 'pattern'
ELSE 'motif' ELSE 'motif'
END AS facet END AS facet
FROM categories_v2_lft_rgt FROM categories
WHERE id IN (${createQuestionMarksFromList(allFacetParentIds)}) WHERE id IN (${createQuestionMarksFromList(allFacetParentIds)})
) )
SELECT SELECT
@@ -149,7 +149,7 @@ WHERE product_category.product_id = ?
array_agg(DISTINCT c.name) FILTER (WHERE fp.facet = 'pattern') AS pattern, array_agg(DISTINCT c.name) FILTER (WHERE fp.facet = 'pattern') AS pattern,
array_agg(DISTINCT fp.name) FILTER (WHERE fp.facet = 'motif') AS motif array_agg(DISTINCT fp.name) FILTER (WHERE fp.facet = 'motif') AS motif
FROM product_category pc FROM product_category pc
JOIN categories_v2_lft_rgt c ON c.id = pc.category_id JOIN categories c ON c.id = pc.category_id
JOIN facet_parents fp ON c.lft > fp.lft AND c.rgt < fp.rgt JOIN facet_parents fp ON c.lft > fp.lft AND c.rgt < fp.rgt
WHERE pc.product_id = ? WHERE pc.product_id = ?
`, `,
@@ -227,7 +227,7 @@ WHERE product_category.product_id = ?
queryBuilder.whereIn('id', ids); queryBuilder.whereIn('id', ids);
} }
}) })
.from('v_categorytree_v2') .from('v_categorytree')
// @ts-ignore // @ts-ignore
.cache(MINUTE) .cache(MINUTE)
); );