Skip to content

Instantly share code, notes, and snippets.

@ProNotion
Last active April 25, 2025 08:27
Show Gist options
  • Save ProNotion/1436b656eb3e8dc18f4bb409ca5a4d56 to your computer and use it in GitHub Desktop.
Save ProNotion/1436b656eb3e8dc18f4bb409ca5a4d56 to your computer and use it in GitHub Desktop.
Umbraco 7 - Retrieve a list of nodes with saved but unpublished changes
-- Retrieves content items that have a newer, unpublished version than the currently published version.
SELECT
c.nodeId AS ContentId,
un.text AS NodeName,
CONCAT('https://example.com/umbraco#/content/content/edit/', c.nodeId) AS Link
FROM cmsContent c
JOIN cmsContentVersion cv ON c.nodeId = cv.ContentId
JOIN cmsDocument d ON c.nodeId = d.nodeId
JOIN umbracoNode un ON c.nodeId = un.id
WHERE cv.id = (
SELECT MAX(cv2.id)
FROM cmsContentVersion cv2
WHERE cv2.ContentId = c.nodeId
)
AND d.published = 1 -- The content has a published version
AND d.updateDate < cv.versionDate -- There is a newer, unpublished version
ORDER BY c.nodeId;
@ProNotion
Copy link
Author

Here for posterity having been used ahead of a large scale migration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment