mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-01-28 22:01:24 +00:00
fix: swap parent and child logic for TAG_CHILDREN_QUERY (#1064)
This commit is contained in:
committed by
GitHub
parent
3125a995a7
commit
3a0da4699a
@@ -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):
|
||||
|
||||
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user