8425 - Align legacy ancestor view with v2 behavior (#565)

This commit is contained in:
Anders Gustafsson
2026-06-16 14:02:33 +02:00
committed by GitHub
parent 65c6d586cc
commit e6c2192079
+11
View File
@@ -0,0 +1,11 @@
-- Align legacy ancestor view with v2 behavior by excluding root category id = 1.
CREATE OR REPLACE VIEW v_category_with_ancestors AS
SELECT c.id,
parent.id AS ancestor_id,
parent.name
FROM categories c
LEFT JOIN categories parent
ON parent.lft <= c.lft
AND parent.rgt >= c.rgt
AND parent.id <> 1
WHERE c.id <> 1;