8425 - stop using v2 category tables and views (#190)
This commit is contained in:
@@ -82,7 +82,7 @@ WHERE product_category.product_id = ?
|
||||
SELECT product_category.category_id as id,
|
||||
categories.*
|
||||
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 = ?
|
||||
`;
|
||||
|
||||
@@ -101,7 +101,7 @@ WHERE product_category.product_id = ?
|
||||
const { rows } = await this.cachedRaw(
|
||||
/* sql */ `
|
||||
SELECT id
|
||||
FROM v_categorytree_v2
|
||||
FROM v_categorytree
|
||||
WHERE depth = 1
|
||||
AND id NOT IN (${createQuestionMarksFromList(KNOWN_FACET_PARENT_IDS)})
|
||||
`,
|
||||
@@ -139,7 +139,7 @@ WHERE product_category.product_id = ?
|
||||
WHEN id = ? THEN 'pattern'
|
||||
ELSE 'motif'
|
||||
END AS facet
|
||||
FROM categories_v2_lft_rgt
|
||||
FROM categories
|
||||
WHERE id IN (${createQuestionMarksFromList(allFacetParentIds)})
|
||||
)
|
||||
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 fp.name) FILTER (WHERE fp.facet = 'motif') AS motif
|
||||
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
|
||||
WHERE pc.product_id = ?
|
||||
`,
|
||||
@@ -227,7 +227,7 @@ WHERE product_category.product_id = ?
|
||||
queryBuilder.whereIn('id', ids);
|
||||
}
|
||||
})
|
||||
.from('v_categorytree_v2')
|
||||
.from('v_categorytree')
|
||||
// @ts-ignore
|
||||
.cache(MINUTE)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user