Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomas 160 posts 335 karma points
    Jun 20, 2023 @ 19:13
    Thomas
    0

    SQL Query to get all content with documentType "Article"

    Hi, I have a customer and he wants to migrate his site from umbraco to wordpress. Don't ask me why.... no comments about that. Never mind. I need a query to export all the documents from the database with specific document type.

    Any help?

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Jun 20, 2023 @ 19:59
    Marc Goodson
    0

    Hi Thomas

    Depending on the properties you have on your Document Type, that will be quite a complex query, as Umbraco stores a value for each property of a Document Type in a separate row in cmsPropertyData table, and there is a value stored for every 'version' of that document.

    Also if the Document Type has a 'Media Picker', maybe for your Main Article image, then the value stored will be the unique Id of the Media Item, which won't help the import at the WordPress side.

    Similarly if the DocumentType is using the grid, there will be a mass of JSON, possibly containing images / macros etc

    Often when you are creating these kinds of exports, what I'd actually do is create a new 'Alt Template' or hijacked controller action that will loop through the Umbraco Published Cache and write out either a CSV or an XML file containing all of the content of the particular type.

    You can then request the page via the altTemplate and save the outputted CSV/XML to a file to distribute to the Wordpress team.

    This way for images, you can write out the /media/path/23434/totheimage.jpg - so it can easily be requested and sucked in by the external system.

    Anyway just a thought to save lots of Inner Joins!

    regards

    Marc

Please Sign in or register to post replies

Write your reply to:

Draft