Upgrading a Database Schema

Notice
CM4D Database schema upgrades should only be performed by a Corporate IT Professional, DBA or a CM4D user that very knowledgable about CM4D databases.

After upgrading a CM4D Installation, you may have databases from one or more schema versions back that you want to access. To access those databases, you need to migrate the databases to the latest schema version using the upgrade path(s) below.

Reference
Database scripts are included with each CM4D Enterprise installation, but you may also download them from our website.

Before you begin the upgrade process, you will need to answer the following questions:

Are you upgrading a Site Database?

1.     Yes - Along with upgrading the CM4D Site database schema, you will also need to upgrade any CM4D DataSource databases that are managed by the CM4D Site database to the corresponding CM4D DataSource database Schema.

2.     No - Upgrade your unmanaged CM4D DataSource databases to the correct CM4D DataSource database Schema.

What is the version of your current Database(s)?

1.     Single-Schema Upgrades - If you are upgrading to the newest version of CM4D from the previous version of CM4D, you will only need to run the latest upgrade script(s) on your database(s).

2.     Multiple-Schema Upgrades - If you are upgrading to the newest version of CM4D from a version older than one release, you will need to run all intermediate update scripts on your database(s) consecutively before updating to the latest Schema version. Refer to the Database Schema Reference for a list of versions and schema.

How to Update a Database Schema

The following steps are a general guideline for upgrading your database Schema.

1.     Backup existing database(s)

2.     Determine current database Schema

3.     Run update scripts

4.     Check database connection

Backup Existing Database(s)

Before executing any update scripts on your database(s), it is very important that you create a backup of your existing database(s). Once you have confirmed that the backup process was successful and complete, continue on to the next step.

Notice
You should always test an upgraded copy of your production database(s) in a test environment before upgrading your production databases to a new schema.

Determine Current Database Schema

All Schema upgrades must start with your current database Schema. If you do not know your current Schema, look at the SiteSchemaVersion and SchemaVersion Stored Procedures in your Database.

1.     Run SQL Server Management Studio.

2.     Expand Databases > YourDatabase > Programmability > Stored Procedures.

3.     Find the stored procedure:

a.     For a Site database - dbo.SiteSchemaVersion

b.     For a CM4D database - dbo.SchemaVersion

4.     Right-click on the stored procedure and select Modify.

a.     Look for the string @version =

b.     The Schema version will follow the equal sign in single quotes (e.g., '19a').

c.      Do not make any changes to the stored procedure.

5.     Exit SQL Server Management Studio.

Run Update Scripts

To upgrade the CM4D Schema version that is used by the new version of CM4D, you must run the appropriate Update scripts in sequential order. The update scripts will be provided along with the CM4D installation when you receive your upgrade.

Upgrading a SQL Server Database Schema

Notice
If you receive any errors while executing an update script, you must correct the issue(s) before continuing to the next script.

Example
To see an example of upgrading a SQL database from Schema 14a to v19a, click here.

Reference
Refer to the topic Database Schema Reference to more information on upgrade paths and versions.

Site Schema Upgrade Path

Use the following upgrade path(s) to upgrade your Site Database(s). Starting with your current Site database Schema version, run each script sequentially until you reach the latest Schema version.

Refer to Site Database Upgrade Paths

CM4D DataSource Schema Upgrade Path

Use the following upgrade path(s) to upgrade your CM4D DataSource(s). Starting with your current CM4D DataSource database Schema version, run each script sequentially until you reach the latest Schema version.

Refer to CM4D Database Upgrade Paths

Check Database Connection

Once your database Schema has been upgraded, check that CM4D can connect to the database.

1.     Run DbConnect.exe.

2.     Click the Test Connection button.

If you have successfully connected to the database, your Schema upgrade is complete.