Copied to clipboard

Flag this post as spam?

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

  • Ben Norman 167 posts 275 karma points
    Mar 14, 2019 @ 22:16
    Ben Norman

    Upgrade from v7 to v8

    There is a major change in the databases when moving from v7 to v8.

    The migrations fail to complete the conversion of the databases for at the moment.

    I have concluded that at the moment the code will only make a new database and not be able to migrate a database.

    Is that correct?

    Should I be waiting for v8.0.1?

    Should I be trying something different?

    Has anyone upgraded an MSSQL Database yet?

    Here is why I think that:

    The tables seem to be being updated from having a prefix of cms to umbraco. For example cmsPropertyData to umbracoPropertyData and cmsContentType to umbracoContentType.

    I cannot find the code that changes the cmsContentType table to umbracoContentType and have a couple of spots that execute sql statements that work on sqlce and not on mssql.

    I'm not sure how to proceed but I have been building a sql script that gets me through but i think i a must be missing something or this is just not yet complete. I still have a bunch of cms prefixed tables and the migration is trying to update the umbraco tables.

    Create a new working v8.0.0 site on a new mssql 2014 db.

    Checkout UmbracoCms repo at tag release-8.0.0 and update VariantsMigration.cs on line 52 by removing the word COLUMN from the sql statement as shown below SQL Command that needed to be updated

    Compile UmbracoCms repo.

    Copy Umbraco.Core dll over to the new v8 running site.

    Restore a copy of a working and fully populated 7.13.1 db over the newly created v8.0.0 db

    Update the cms version in the web.config to 7.13.1

    delete the log file

    reset iis

    run the upgrade by visiting the v8 site

    I have had to recompile v8 Umbraco.Core to fix up some of the SQLCE commands to be more MSSQL.

    Below is the sql statement that I have to run to reset the database which includes removing the audit trail but removes a couple of constraints which fail along the way. I have removed the password update so make sure you replace the password hash with your own.

    USE [master]
    RESTORE DATABASE [inspirecmsv8] FROM  DISK = N'C:\Database\SQL2014DEV\Backup\inspirecms (6)\inspirecms.bak' WITH  FILE = 1,  MOVE N'inspirecms_data' TO N'C:\Database\SQL2014DEV\Data\inspirecmsv8_data.mdf',  MOVE N'inspirecms_log' TO N'C:\Database\SQL2014DEV\Data\inspirecmsv8_log.ldf',  NOUNLOAD,  REPLACE,  STATS = 5
    USE [inspirecmsv8]
    UPDATE [dbo].[umbracoUser]
       SET [userDisabled] = 0
          ,[userNoConsole] = 0
          ,[userPassword] = '## Hashed Password ##'
     WHERE [userEmail] = '[email protected]'
    ALTER TABLE [dbo].[cmsDocument] DROP CONSTRAINT [DF_cmsDocument_updateDate]
    ALTER TABLE [dbo].[cmsDocument] DROP CONSTRAINT [DF_cmsDocument_newest]
    TRUNCATE TABLE umbracoLog 
    --TRUNCATE TABLE umbracoUser2NodePermission
    --TRUNCATE TABLE umbracoUserLogins
    -- Create a temporary table for all documents which are published and not in the recycle bin
    CREATE TABLE #Nodes (id int)
    -- Delete all rows if the table exists before
    -- Insert all nodeIds from all documents which are published and not in the recycle bin
    INSERT INTO #Nodes 
        FROM umbracoNode N
            INNER JOIN cmsDocument D ON N.ID = D.NodeId
        WHERE nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972'
            AND [path] NOT LIKE '%-20%'
            AND D.Published = 1
    -- Create a temporary table for all versionId's to delete
    CREATE TABLE #Versions (id UniqueIdentifier)
    -- Delete all rows if it exists before
    TRUNCATE TABLE #Versions
    -- Insert all versionId's from all nodeIds in the #Nodes table 
    -- and where published is set to false and newest is set to false
    INSERT INTO #Versions
        SELECT versionId 
        FROM cmsDocument 
        WHERE nodeId IN (SELECT id FROM #Nodes) AND published = 0 AND newest = 0
    -- DELETE all versions from cmsPreviewXml, cmsPropertyData, cmsContentVersion, cmsDocument
    -- from the nodes which are published and which are not in the recycle bin 
    -- and which are not published and which are not the newest
    DELETE FROM cmsPreviewXml WHERE versionId IN (SELECT id FROM #Versions)
    DELETE FROM cmsPropertyData WHERE VersionId IN (SELECT id FROM #Versions)
    DELETE FROM cmsContentVersion WHERE VersionId IN (SELECT id FROM #Versions)
    DELETE FROM cmsDocument WHERE VersionId IN (SELECT id FROM #Versions)
    -- Drop temp tables
    DROP TABLE #Versions
    DROP TABLE #Nodes
    -- Reindex tables  
    DBCC DBREINDEX (cmsPropertyData)
    DBCC DBREINDEX (cmsPreviewXml)
    DBCC DBREINDEX (cmsContentVersion)
    DBCC DBREINDEX (cmsDocument)
    DBCC DBREINDEX (cmsContentXml)
    DBCC DBREINDEX (umbracoDomains)
    --DBCC DBREINDEX (umbracoUser2NodePermission)
    DBCC DBREINDEX (umbracoNode)
    DBCC DBREINDEX (cmsContent)
    CREATE TABLE [dbo].[umbracoMediaVersion](
        [id] [int] NOT NULL,
        [path] [nvarchar](255) NULL,
        [id] ASC
    ) ON [PRIMARY]
    ) ON [PRIMARY]
  • Benjamin Carleski 33 posts 294 karma points MVP c-trib
    Mar 14, 2019 @ 22:33
    Benjamin Carleski

    In their blog post introducing Umbraco 8, HQ mentioned that automatic upgrades from v7 to v8 were not currently supported, but "very soon it will be possible to migrate your content". I've seen nothing saying they have released the ability to migrate content yet, so I think until that comes out, there isn't a supported path. That said, it looks like you've done a lot of work, maybe someone at HQ will see it and collaborate!

  • Sebastiaan Janssen 5026 posts 15390 karma points MVP admin hq
    Mar 14, 2019 @ 22:57
    Sebastiaan Janssen

    Hi Ben, I'm sorry but this will definitely not be sufficient to migrate your db to v8.

    There is currently not an upgrade path to go from v7 to v8, there will be a migration path in the future:

    We're working on it for v8.1.0 and ask for a little patience until then 👍

  • Ben Norman 167 posts 275 karma points
    Mar 14, 2019 @ 23:02
    Ben Norman

    oh ok, no problem.

    thanks for getting back to me.

  • Jeffrey Weinstein 67 posts 312 karma points
    Jun 10, 2019 @ 11:06
    Jeffrey Weinstein

    If there is any update on this, please post it in this thread..

  • john blair 45 posts 215 karma points
    Aug 20, 2019 @ 11:36
    john blair

    I've migrated a v7.15 of the starter kit to v8.1.2 using umbraco migrations - excluding the app_plugins. The db migration went fine. Had to regenerate the code models which are now in a different namespace and global changes to the razor templates to reflect new v8 code base.

Please Sign in or register to post replies

Write your reply to: