-- @query details_resolve_path
-- @db thumbnailCache 9.0
-- @db localContent 32.0
-- @param thumbnailId TEXT
SELECT COALESCE(
    (SELECT h.ItemPath
     FROM localContent.ItemHierarchyView h
     WHERE h.FileSystemID = tm.fileSystemId
     LIMIT 1),
    (SELECT h.ItemPath
     FROM localContent.ItemHierarchyView h
     WHERE h.DriveItemID = tm.driveItemId
     LIMIT 1)
)
FROM thumbnailCache.thumbnail_metadata tm
WHERE tm.id = ?thumbnailId
LIMIT 1
