How to create clean EPiServer 8 database?



Now when deployment center is no longer available (?) how are we supposed to create empty SQL databases for new sites?

The command Update-EPiDatabase is used when upgrading versions via nuget, but is there a command for creating a new database from scratch?


May 04, 2015 16:42

My way of doing this might not be best practice but I sttill use Deployment Center, what wil happen when this is gone I have no idea, but for now it is working.

Install empty db from deployment center, 7.5

Run Update-EpiDatabase from within an empty project.

Thats it.

When installing a new project from VS you will also get an empty database but you will need to restore the files as a db in sql server.

May 04, 2015 17:32

Create new site in VS Extensions, don't choose to import Alloy stuff - instead, create an empty site. You may wondering what would I do with .mdf file under App_Data? Just attach as database in SQL Server - and you are all set.

May 04, 2015 21:09

I do like Valdis say. It works great.

May 04, 2015 21:30

And since we are repeating our self.. I was exactly what I said with the last sentence i my previous post ;)

May 05, 2015 13:46

Just a quick update on this one. As of 8.8 we have a new cmdlet "Initialize-EPiDatabase". This allows you to install a new EPiServer database into an empty database.

See more:


Jun 16, 2015 17:20

oh, that's nice.

Jun 17, 2015 19:25

Like others said

I sometimes start with the MDF-file from an empty Alloy db like Valdis said but typically download the database from the GitHub repo

Place it in App_Data and use the following connectionstring

<add name="EPiServerDB" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|Alloy.mdf;Initial Catalog=Alloy;Connection Timeout=60;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />

and run the Initialize-EPiDatabase command from the Package Manager Console

If you are missing the MDF-file simply create a new using Visual Studio, create a new item and select the SQL Server Database, when created run the Initialize-Epidatabase command

Edited, Apr 04, 2018 23:03

The actual SQL script with the CMS database schema is bundled in the EPiServer.CMS.Core package. You can find it in the package under /tools/EPiServer.CMS.Core.sql

So you can e.g. create a new empty database in SQL Managment studio and execute the script on the database.

Another options is to set atttribute 'createDatabaseSchema=true' on the episerver.framework element in web.config (it will not create the actual database but will install the schema if the connection string points to an database without the cms schema)

Edited, Apr 05, 2018 12:07
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.