A Guide to Updating Your Umbraco Database Version
If you want to migrate the Umbraco version 7 project to Umbraco version 10, It is directly not possible to migrate version 7 to version 10. First need to migrate database version 7 to version 8 properly then migrate database version 8 to version 10.
There are different steps for performing the migration from version 7 to version 10.
Table of Contents
- How to migrate database version 7 to version 8 Step by Step?
- Challenges faced while migrating from version 7 to version 8 with respected solutions
- How to migrate database version 8 to version 10 Step by Step?
- Challenges faced while migrating from version 8 to version 10 with a reliable solution
- Conclusion
How to migrate database version 7 to version 8 Step by Step?
Here is a step-by-step process laid out for your reference. If you feel this is complicated for you, hire an expert Umbraco development company, and let them handle the migration for you.
Check your Current Database Version
- Make sure that your version 7 project is running at least Umbraco 7.14.
Check your database type
- Umbraco version 8 does not support MySQL databases.
- Umbraco version 8 supports SQL Server and SQL CE.
Back up your database
- Keep in mind that your database and your data will not be transferred during the migration - they will be directly transformed.
- During the migration process, your entire Umbraco version 7 database is transformed into the format needed for Umbraco version 8.
- The same will happen to your existing compatible data - it will be transformed according to how Umbraco version 8 stores data.
If something goes wrong during the migration, with a backup, you'll be able to roll back and try to migrate again.
Clean Up your Site
It's necessary to clean up your site before running this as it will be quicker.
- Clean Content of recycle bin.
- Clean Media recycle bin.
- Clean up the database version history (can be done with a script or a package like https://our.umbraco.com/packages/website-utilities/unversion/).
Upgrade to Version 7.15+
Before the content migration can start the site has to run Umbraco 7.15+. Make sure to always take a backup of the database before doing an upgrade, and then check the version-specific upgrade instructions.
The site in this example is an Umbraco 7.14.1 site, and we will use NuGet to update it.
We have upgraded database migration facing current version not detected.
The database configuration failed with the following message: Invalid object name 'umbracoKeyValue'.
To solve this error, add in web.config file check old version.
When you start the site, it will ask you to login and then show you the screen given below:
- After this, click on the Continue button to start the migration process from version 7.15.6 to version 8.2.3.
Above are the general steps to follow to do a migration from your Umbraco 7 site to Umbraco 8.
When you are doing Database migration you will face so many unknown issues. I have created a list of issues and solutions that will help you to do your migration smoothly.
Here is a step-by-step process laid out for your reference. If you feel this is complicated for you, hire an expert Umbraco development company, and let them handle the migration for you.
Challenges Faced while Migrating from Version 7 to Version 8 with a Reliable Solution
1. Database Time-out Issue
- The very first error faced is a timeout issue with the database.
- While performing database migration, there are lots of processes running in the background which requires more time to process.
- Below is the screenshot of the issue and solution for the same.
Add a connection timeout parameter in the Connection string in the web.config file set a timeout and increase the amount of time.
Below attached the solution screenshot for better understanding
If you are still facing the same issue you need to check for Backoffice timeout in web.config.
The default time is 20 minutes, you can increase this as per your project requirements.
And increased execution timeout.
2. Removing Unwanted Data Columns
In the database, there are so many tables that have lots of unwanted types of columns and data stored in the table which will throw an error while migration.
So, it needs to be cleaned and some data types will be Obsolete which is generating the issues.
Then remove this obsolete datatype in the version 7 project from the back-office side.
This is the list of obsolete Property Editors we are using in Umbraco version 7 and need to change that properties that are shown in below:
- (Obsolete) Nested Content to Nested Content
- (Obsolete) Media Picker to Media Picker
- (Obsolete) Content Picker to Content Picker
- (Obsolete) Member Picker to Member Picker
- (Obsolete) Multinode Treepicker to Multinode Treepicker
- (Obsolete) Related Links to Multi URL Picker
3. Challenge of Database Cleanup With Script
Here are a few lines of code to clean up the database easily. This is just an example; please connect with us to cleanup your Database with script.
select * from umbracoLog
TRUNCATE TABLE umbracoLog
GO
--TRUNCATE TABLE umbracoUser2NodePermission
GO
--TRUNCATE TABLE umbracoUserLogins
GO
PRINT 'Clean n Create Node Table'
--/****** Object: Table [dbo].[Customer] Script Date: 28-04-2023 17:38:10 ******/
--IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Customer]') AND type in (N'U'))
--TRUNCATE TABLE [dbo].[#Nodes]
--GO
-- Create a temporary table for all documents which are published and not in the recycle bin
CREATE TABLE #Nodes (id int)
GO
-- Delete all rows if it exists before
TRUNCATE TABLE #Nodes
GO
Print 'Records'
select Count(*) from #Nodes
4. Error for Database Collation Name
For this, you need to change the database collation name to the Required Collation name.
You can check the collation name via the query below.
SELECT DATABASEPROPERTYEX('Database_Name', 'Collation');
If you find out it is different from required you need to change that to require via the query below:-
ALTER DATABASE [Database_Name] COLLATE Required_collation_Name
When you are working with collation you just need to check that the database is not in use with other sites or that all processes are stopped.
you can stop another process by using the below query:-
ALTER DATABASE [Your Database Name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE.
Once your change is done you need to fire this query:-
ALTER DATABASE [Your Database Name] SET MULTI_USER WITH ROLLBACK IMMEDIATE.
Content Migration
In Umbraco 7, you can use the Umbraco Helper class to access Umbraco features. However, in Umbraco 8, you should use dependency injection instead.
You can use site instead of root and Getpropertyvalue instead of Value.
This error occurred because the transaction log file has Excessive data
To resolve this error you need to do some cleanup process for the log file like below screen shots.
Right-click on database > properties > Files.
You need to check Enable auto growth.
After this step need to clean the log file.
Right-click on database > Tasks > shrink add do below change
5. Accessing Backoffice and Frontend View
If you are not able to access the back office and front-end view you need to follow this below step.
Perform database migration process via NuGet package manager as a solution to this error.
Make sure to conduct this Migration process via fresh set up of Umbraco 8 version from Umbraco official site:-
https://our.umbraco.com/download/releases/823
Download the ZIP file from the above link (based on the required version) do the setup and install the NuGet package for the version.
Probably all your errors are fixed in the Umbraco version 7 to version 8 database migration process using the provided solutions.
How to migrate database version 8 to version 10 Step by Step?
Check Your Current Database Version
Make sure that your version 8 project is running at least Umbraco 8.2.3
Back up your database:-Keep in mind that your database and your data will not be transferred during the migration - they will be directly transformed.
Clean Up your Site
It is highly recommended to clean up your site before running this as it will be quicker.
- Clean Content of recycle bin.
- Clean Media recycle bin.
Clean up the database version history (can be done with a script or a package like Unversion)
- Before you started migration process need to clean database of Umbraco version 8 using the database clean up script
The database clean-up script is given below for migrating Umbraco version 8 to Umbraco version 10.
SQL Script:-
PRINT 'Clearing log- and audit tables'
TRUNCATE TABLE umbracoLog
GO
TRUNCATE TABLE umbracoAudit
GO
TRUNCATE TABLE umbracoUserLogin
GO
PRINT 'Select all published document nodes'
-- Create a temporary table for all documents which are published and not in the recycle bin
DROP TABLE
IF EXISTS #Nodes
CREATE TABLE #Nodes (id INT)
GO
This is just example code. For complete solutions contact us.
Upgrade to 8.2.3+
Before the content migration can start the site has to run Umbraco version 8.2.3+. Make sure to always take a backup of the database before doing an upgrade, and then check the version-specific upgrade instructions.
Challenges Faced While Performing a Migration from Version 8 to Version 10 with Respected Solutions
When you are doing Database migration you will face so many unknown issues. I have created a list of issues and solutions that will help you to do your migration smoothly and properly.
1. Database Time-Out Issue
This is the common error for both processes but when we are performing migration from version 8 to version 10 it converts the folder structure like asp.net core.
Add connection timeout in the Connection string and add a timeout and increase it to a big amount of time.
Need to change in the app setting to .json file
If you are still facing the same issue you need to check for Backoffice timeout in the appsetting.json file.
2. In Database migration if you get the error for database cannot insert the null value.
For this you need to change the database table cmsMember.
Here is the query that needs to run in the database for above given error
ALTER TABLE cmsMember
ADD isApproved bit null;
3. Error in the Forms from Backoffice
This error needs to change in the database table UmbracoKeyValue
Here is the query you need to run in the database for above given error.
UPDATE UmbracoKeyValue
SET key 'Umbraco.Core.Upgrader.State+UmbracoForms_OLD'
WHERE key = 'Umbraco.Core.Upgrader.State+UmbracoForms'
4. Error in the Back office Post Migration
For solving the above error need to check the all-document type which are used in the content and remove the document type and create again for same.
And need to check in the database table cmsContentNu
In this table you need to find the value 301 and remove this value using the update query in the SQL server.
5. Error in Backoffice like Rhythm.FontAwesomeIconPicker
For this error need to check the dependency of the FontAwesomeIconPicker in the datatype and then remove Rhythm.FontAwesomeIconPicker from the datatype and select the new datatype Font Awesome Icon Picker Umbraco.Label.
This is the complete process of the database migration from Umbraco version 7 to Umbraco version 10.
Conclusion
To sum up, upgrading the version of your Umbraco database is an important yet doable step that can significantly improve the functionality, security, and efficiency of your Umbraco-powered website. You can navigate the update process with confidence and reduce the risk of downtime to your website's operations by adhering to the best practices described in this guide, which include extensive testing, incremental migration, thorough documentation, and encouraging stakeholder collaboration. Recall that keeping up with the most recent updates and making use of the documentation and Umbraco community's resources will enable you to make well-informed decisions and guarantee a seamless upgrade to the newest database version. You may maintain an Umbraco website that is successful and up to date by following best practices, preparing carefully, carrying out the plan with diligence, and following through.
Author Bio
Divyesha is an Associate Software Engineer with a passion for technology and web development. Her journey in the IT industry began in January 2023, and since then, she has been dedicated to expanding her knowledge and expertise in software development. She is committed to continuous growth in her career, aiming to take on more responsibilities within the company and excel in the world of software engineering.