In this tutorial, you will learn how to install the Episerver database using a SQL script as well as patching that database to use the latest version. This is a follow-on post from, How The Episerver 'Installation' And 'Update' Powershell Functions Work Under Da Hood.

When you install the Episerver Nuget package you will get access to several SQL scripts that will create all the tables and stored procedures required by Episerver in order to create a fresh CMS database. If you try and run these SQL scripts manually, SQL will moan and fail. This is because you need to run these commands via PowerShell. Episerver provides two useful PowerShell functions that you can call within your Nuget Package Management Console that will execute these SQL scripts for you. Running the PowerShell functions rather than the SQL script directly will make your life easier. The Powershell scripts will set and pass in all the correct variables and configurations the SQL script needs to run. Want to learn how to do this, read on!!

What Is Epideploy.exe?

epideploy.exe is a tool that comes as part of the Epi Framework, within the Episerver.Core Nuget package. If you look within your NuGet packages folder you should see a folder called (as seen below). In this folder, you should be able to find a directory called tools. It is within here that you will find the Powershell scripts!

How To Export Episerver Database Update Patches To Use Within Your Build Process 1

What Is Export-EPiUpdates?

Export-EPiUpdates is a PowerShell function provided by Episerver that you can use to help you upgrade your SQL database when you want to upgrade Episerver. Export-EpiUpdates will export all the SQL scripts required to upgrade an Episerver database to the latest version for the CMS, Episerver Find and Episerver Commerce. When run, Export-EpiUpdates will create a new folder called _epideploy_ that will contain a batch file and all the scripts required to update you database.

How To Export Episerver Database Update Patches To Use Within Your Build Process 2

To upgrade your database, you simply run the batch file passing in the path to your website, code example is shown below:

If the script ran successfully, you will now have an updated and patched database! As you can see, upgrading your Episerver database is pretty simple. In a perfect world, the upgrade path would involve a single superscript, however, having a two-step process is fine. This process is much better than the majority of CMS platforms out there. With that simple script, you now have a patched website, Happy Coding 🤘