-- @query import_special_photos_folder
-- @db media 11.0
-- @db localContent 32.0
SELECT
    mf.driveItemId,
    h.ItemPath,
    m.LocalID
FROM media.media_folders mf
INNER JOIN localContent.ItemHierarchyView h ON h.DriveItemID = mf.driveItemId
INNER JOIN localContent.ItemMetadata m ON h.FileSystemID = m.FileSystemID
WHERE json_extract(mf.specialFolderFacet, '$.name') = 'photos'
  AND mf.isTombstoned = 0
LIMIT 1
