---
title: Install database schema
slug: cms-13/docs/install-database-schema
docTags: 
createdAt: 2026-07-30T20:22:05.208Z
---

Optimizely Content Management System (CMS) 13 stores content and configuration data in a Microsoft SQL Server database. CMS supports SQL Server and SQL Azure. See [System requirements](docId:6mzuo0wOX9wKMx3stzq0_) for supported SQL Server versions.

## Install from the Visual Studio integration

The Optimizely database schema groups tables, views, and stored procedures. When you create a site from the Visual Studio integration, the integration creates the database with the Optimizely schema automatically. Each schema version corresponds to a specific CMS version. See the following topics for deploying a database from development to production:

- [Deploy to Azure Web Apps](docId\:K2_xGil1cnFT8xjCZ17A9)
- [Deploy to Windows servers](docId:65qxJF54gx47qAPHvcumc)

## Enable automatic creation of database schema

Configure a site to create the database schema automatically during initialization. At startup, CMS checks whether the schema exists in the database specified by the connection string. If no schema exists and automatic creation is enabled, CMS runs an SQL script that creates the schema.

To enable automatic schema creation, add the `CreateDatabaseSchema` attribute to `appsettings.json` and set it to `true`:

```csharp
{
  "EpiServer": {
    "Cms": {
      "DataAccess": {
        "CreateDatabaseSchema": "true"
      }
    }
  }
}
```

Or configure it in code:

```csharp
public class Startup {
  public void ConfigureServices(IServiceCollection services) {
    services.Configure<DataAccessOptions>(o => {
      o.CreateDatabaseSchema = true;
    });
  }
}
```

Automatic schema creation uses the same process as schema updates. Register an `IDatabaseSchemaValidator` implementation in the Optimizely IOC container to interact with the creation process. See [Automatic schema updates](docId\:ayqMumaTWXkG_H_4GGddV).

## Create database manually

To deploy the schema manually, find the SQL script files in the `EPiServer.CMS.Core` NuGet package under the `tools` subfolder.

## Best practices when setting up the database

Consider the following recommendations:

- Do not directly access or modify CMS tables or stored procedures, or create custom tables that interfere with CMS tables. Use the documented API instead. Backward compatibility at the database level is not guaranteed.
- CMS supports several SQL Server high-availability options, including failover clustering and database mirroring. Database mirroring maintains a standby database in read-only mode, and SQL Server copies transactions to the mirror synchronously or asynchronously. Configure instant failover using a witness server.
- Create a maintenance plan for your production SQL Server database that includes backups, database consistency checks, and index rebuilds. Database performance degrades over time without a maintenance plan, especially if you do not rebuild indexes as content grows. For more information, see Microsoft: Maintenance Plans.
