Manually trigger a database update after upgrading Umbraco

So here’s the scenario. You’ve just upgraded Umbraco in your development project to the latest version using NuGet (because why would you do it any other way?). You’ve built the solution, you visit the website and see this screen:

upgradingumbraco

You click ‘Continue’ (and then immediately wish you had taken a backup of your database before you clicked that button, because that’s what good developers should do!) and Umbraco goes off and does some database bits and bobs behind the scenes before redirecting you back into Umbraco. Yeay it worked!

You click around a bit, publish a few items here and there, and you’re now ready to deploy your updated Umbraco installation to your staging and production environments. But how can you trigger that database update process again because it’s already happened? There has to be a secret command or spell you can use to initiate it, but you can’t remember for the life of you what it is (and it’s actually quite difficult to find the answer from Google too!).

So here’s how to do it in 2 easy steps:

Step 1 – ensure you have the umbraco/install folder present in the environment you’re updating. Of course we all know that it’s bad security practise to have this folder in any public-facing Umbraco installation, so please remember to remove it once your update has finished. (Oh you didn’t know that? Well, now you know – you can impress your friends with this new found knowledge!)

Step 2 – open up the web.config file of your Umbraco website and look for the key called “umbracoConfigurationStatus”. It should look something like this:

<add key="umbracoConfigurationStatus" value="7.2.6" />

The value in this case is the version that you just upgraded to.

Decrease this value by 1 so it looks something like this:

<add key="umbracoConfigurationStatus" value="7.2.5" />

and that’s all you need to do.

Deploy your Umbraco codebase to your staging or production environment, and you will see that same upgrade splash screen. Click the ‘Continue’ button, promise yourself that next time you really will take a database backup before clicking that button, and let Umbraco do it’s magic.

Once the update is complete and you’re back in the Umbraco portal, look at the web.config file again and you will see the version number has been incremented back up to the current installed version.

P.S. after tweeting this article and before I even managed to get a cup of tea, Sebastiaan Janssen (Project Manager at Umbraco HQ) replied with some further info on this. I’m not going to re-write this article though as my cuppa is going cold, so here’s Sebastiaan’s tweets with that info:

 

So effectively you only have to worry about triggering this database update when you do minor version upgrades, and you don’t have to worry about it at all after version 7.3!

Posted in Umbraco Tagged with:

About Maff

Maff Rigby

I'm a certified .Net, Umbraco and AngularJS freelance developer with over 15 years experience in the IT industry. As well as writing code I love to teach; I run a number of workshops and 1-1 coaching sessions on Angular JS and Umbraco, and share what I know and learn here!

I’m social (ish)

Connect with me on LinkedIn, follow me on Twitter, or fail to find me on Facebook.