Search code examples
automationepiserveroctopus-deploy

Using Octopus Deploy with EPiServer to handle database upgrades


Since EPiServer 7 upgrading to a newer version has involved:

  1. Updating all EPiServer.* NuGet packages
  2. Running PM > Update-EPiServer - to upgrade the local database
  3. Running PM > Export-EPiServer - to produce a set of database upgrade script files that can be run on other servers.

However if only the upgraded EPiServer solution is built and deployed by Octopus Deploy, the database will not be upgraded meaning the site will not run.

Currently I run the EPiServerPackage manually on a server in each of our environments after a deployment.

I'm trying to decide on the cleanest way to include the /EPiUpdatePackage folder and contents running the Export-EPiServer command produces so that it will:

  • Checked into source control
  • Turned into a NuGet package on the build server
  • Be deployed by Octopus Deploy so that it can be remotely executed on the server the script is deployed to

Solution

  • As per Eric Herlitz suggestion, I have simply used the <episerver.framework updateDatabaseSchema="true"> in the web.config transforms for the environments I wish to have the database automatically upgraded on.

    I'm unsure it this will present a problem if the SQL connection string user does not have the required level of permissions. However in my case, this is working correctly.