If you created content and moved it to different spaces using an older version of Confluence, you might experience the issue https://jira.atlassian.com/browse/CONFSERVER-77826. The issue can prevent contents from being transferred to Cloud, please proceed as below to fix that.


  1. Step 1: Please run the below the SQL to identify contents belonging to the wrong containers, if the below query return no result set you can skip Step 2 

    SELECT CONTAINER.CONTENTID AS CONTAINER_ID, CONTAINER.TITLE AS CONTAINER_TITLE, CONTAINER.CONTENTTYPE AS CONTAINER_TYPE, 
    DEPENDANT.CONTENTID AS DEPENDANT_ID, DEPENDANT.TITLE AS DEPENDANT_TITLE, DEPENDANT.CONTENTTYPE AS DEPENDANT_TYPE 
    FROM CONTENT CONTAINER JOIN CONTENT DEPENDANT ON CONTAINER.CONTENTID = DEPENDANT.PAGEID WHERE CONTAINER.SPACEID != DEPENDANT.SPACEID;
    
    SQL
  2. Step 2: PLEASE BACKUP YOUR DATABASE BEFORE EXECUTING THE BELOW SQL CODE

    if the SQL query in Step 1 returns results, the next script fixes all returned records (it updates containers with the wrong spaceid):

    Postgres Dialect

    UPDATE CONTENT SET SPACEID = PROPER_SPACE_ID FROM (SELECT CONTAINER.SPACEID AS PROPER_SPACE_ID, DEPENDANT.CONTENTID AS CONTENT_ID_TO_FIX 
    FROM CONTENT CONTAINER JOIN CONTENT DEPENDANT ON CONTAINER.CONTENTID = DEPENDANT.PAGEID WHERE CONTAINER.SPACEID != DEPENDANT.SPACEID) SUBQUERY WHERE CONTENT.CONTENTID = CONTENT_ID_TO_FIX;
    SQL

    MySQL Dialect

    UPDATE CONTENT C JOIN 
    (SELECT CONTAINER.SPACEID AS PROPER_SPACE_ID, DEPENDANT.CONTENTID AS CONTENT_ID_TO_FIX 
     FROM FROM CONTENT CONTAINER JOIN CONTENT DEPENDANT ON CONTAINER.CONTENTID = DEPENDANT.PAGEID WHERE CONTAINER.SPACEID != DEPENDANT.SPACEID) 
    SUBQUERY ON C.CONTENTID = SUBQUERY.CONTENT_ID_TO_FIX
    SET SPACEID = SUBQUERY.PROPER_SPACE_ID
    SQL


  1. Final Step: After running the above script, all caches have to be flushed: https://confluence.atlassian.com/doc/cache-statistics-150472.html