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,
|
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)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user