In this tutorial, you will learn how to upgrade the Umbraco database to a new version. Every once in a while Umbraco will release an update that will require a database upgrade. We all know we need to upgrade, however, upgrades can be problematic, especially updates to the production website!
A website can be a company's gateway to making sales, generating leads, and building customer engagement. In some companies, zero downtime web hosting is vital. If a website needs to be taken down for maintenance while it's being upgraded, it can cost a company hundreds or even thousands of pounds in lost revenue. One way to create zero time deployments is to do the upgrades offline. In most organisations of a certain size, you will have multiple environments, UAT, Staging, Live. Having these different environments is vital for business continuity, however, it introduces more problems when upgrading. How do you update the database for each environment? Read on to learn how!
When you do an upgrade, Nuget will first update your files and reload the site. When the site reloads, the Umbraco database upgrade wizard will display. A screenshot of this upgrade wizard can be seen below:
After you follow the steps the wizard will update your site and then will not be triggered again. When you deploy your patches files to a new environment that has the old database your site will break. One way to fix this is to copy the database in SQL. You can also force Umbraco to re-run the upgrade wizard. This approach is very useful to know about and it's the focus of this tutorial!
How To Force The Upgrade Wizard To Display
Open up your web.config
file and in appSettings
you should find a key called umbracoConfigurationStatus
:
To force the upgrade wizard to run, you need to revert the value to the version you want to upgrade from. Like this:
When you re-launch the site, the upgrade wizard will run. This tip can be handy for debugging and launching websites. Being able to easily upgrade a database is a very handy feature. Happy Coding 🤘