fix: swap parent and child logic for TAG_CHILDREN_QUERY (#1064)

This commit is contained in:
Travis Abendshien
2025-08-27 03:19:19 -07:00
committed by GitHub
parent 3125a995a7
commit 3a0da4699a
2 changed files with 5 additions and 6 deletions

View File

@@ -96,16 +96,15 @@ DB_VERSION_KEY: str = "DB_VERSION"
DB_VERSION: int = 100
TAG_CHILDREN_QUERY = text("""
-- Note for this entire query that tag_parents.child_id is the parent id and tag_parents.parent_id is the child id due to bad naming
WITH RECURSIVE ChildTags AS (
SELECT :tag_id AS child_id
SELECT :tag_id AS tag_id
UNION
SELECT tp.parent_id AS child_id
SELECT tp.child_id AS tag_id
FROM tag_parents tp
INNER JOIN ChildTags c ON tp.child_id = c.child_id
INNER JOIN ChildTags c ON tp.parent_id = c.tag_id
)
SELECT * FROM ChildTags;
""") # noqa: E501
""")
class ReservedNamespaceError(Exception):

View File

@@ -40,7 +40,7 @@ WITH RECURSIVE ChildTags AS (
INNER JOIN ChildTags c ON tp.parent_id = c.tag_id
)
SELECT tag_id FROM ChildTags;
""") # noqa: E501
""")
def get_filetype_equivalency_list(item: str) -> list[str] | set[str]: