We don’t have the access to our production servers. Thus, we always have to prepare a “one-click” deployment package together with a deployment script that can be passed to our ISP partner to be deployed.

It was a bit time consuming to manually preapre such a script everytime EPiServer schema was changed so we did a little research and found a nice EPiServer tool that helps you with that.
On a developer machine it is pretty easy to just run a single NPM command update-epidatabase which updates your database for you.

In order to create a production upgrade script one can use Export‑EPIUpdates which is also a Nuget Package Manager console command. We have already successfully used it for the last two production upgrades.

The command will run all SQL files one by one on the target database. But of course NPM have no access to production and staging servers. That is why there is this additional command Export-EPiUpdates. The execution result is a dump of SQL and config files (for EPiServer and EPiServer Commerce!) grouped into one root directory together with an executable file epideploy.exe that will help you to easily run it on a target server.

The command result is:

An Export package is created C:\MyProject\src\EPiUpdatePackage
Exporting epiupdates into EPiUpdatePackage\EPiServer.CMS.Core.7.19.2\epiupdates
Exporting epiupdates_CMS into EPiUpdatePackage\EPiServer.Commerce.Core.8.6.1\epiupdates_CMS
Exporting epiupdates_commerce into EPiUpdatePackage\EPiServer.Commerce.Core.8.6.1\epiupdates_commerce

Export-EPiUpdates result tree
If we compare the new deployment strategy introducted together with EPiServer 7.5+ with the old one based on the Deployment Center then without a doubt we get a really simple process with no program installations, cross folder dependencies or multi-step processes. Together with XCOPY deployment, the SQL scripts deployment is a milestone in upgrading the EPiServer platform. Right now we have a package prepared on build server and bunch of portable SQL files that can be applied to the database with a single click.

The process was very simplified and now we are no longer afraid of running upgrades almost in every iteration.

Encrypted ConnectionStrings

Usually, for security reasons, staging and production ConnectionStrings are encrypted. And this is the only one small issue with epideploy tool. The tool reads configuration directly from XML files without the decryption process. So before executing update BAT you should decrypt configs and after deployment you have to encrypt them back again.