From e6c2192079307de13855ca5e159be4f4248009c3 Mon Sep 17 00:00:00 2001 From: Anders Gustafsson <34234789+anders-photowall@users.noreply.github.com> Date: Tue, 16 Jun 2026 14:02:33 +0200 Subject: [PATCH] 8425 - Align legacy ancestor view with v2 behavior (#565) --- migrations/000.638.sql | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 migrations/000.638.sql diff --git a/migrations/000.638.sql b/migrations/000.638.sql new file mode 100644 index 0000000..207cc60 --- /dev/null +++ b/migrations/000.638.sql @@ -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;