# Upgrade the Database Schema

Sometimes the schema of the Media Server database must change in order to provide new features or enhancements. If you are using a database that is hosted on an external database server, you must run an upgrade script when you upgrade Media Server. If you are using an internal database, any schema changes are applied automatically.

IMPORTANT: If you are upgrading from Media Server 11.3 or earlier, and your training data is stored in the internal database, upgrade to Media Server 11.4, 11.5, or 11.6 and start the Media Server. You can then upgrade to Media Server 12.7.

Micro Focus provides scripts to upgrade to the latest version of the database schema. The following table describes the schema changes for the Media Server database.

Schema version | Media Server version | Script to run to upgrade to latest schema
--- | --- | ---
9 | 12.7 | You are using the latest database schema
8 | 12.5 | `my-upgrade_from_v8.sql` (for MYSQL databases) `postgres-upgrade_from_v8.sql` (for PostgreSQL databases)
7 | 12.2 | `my-upgrade_from_v7.sql` (for MYSQL databases) `postgres-upgrade_from_v7.sql` (for PostgreSQL databases)
6 | 12.1 | `my-upgrade_from_v6.sql` (for MYSQL databases) `postgres-upgrade_from_v6.sql` (for PostgreSQL databases)
5 | 11.4 | `my-upgrade_from_v5.sql` (for MYSQL databases) `postgres-upgrade_from_v5.sql` (for PostgreSQL databases)
4 | 11.2 | First upgrade to schema version 5, using the upgrade scripts provided with Media Server 11.4, 11.5, or 11.6, and then upgrade to the latest version.
3 | 11.0 | First upgrade to schema version 5, using the upgrade scripts provided with Media Server 11.4, 11.5, or 11.6, and then upgrade to the latest version.

Running one of these scripts upgrades your database to the latest schema. Older versions of Media Server (with the same major version number) can still use the upgraded database, but do not offer any accuracy or performance improvements associated with the new version.

To upgrade the database schema

1. In the table above, find the version of Media Server that you are upgrading from.

2. Run the corresponding upgrade script for your database, using the same command syntax as used to create the database (see the following topics):

   - Set Up a PostgreSQL Database on Windows
   - Set Up a PostgreSQL Database on Linux
   - Set Up a MySQL Database

   NOTE: Run the upgrade script using the `psql` command-line tool (for PostgreSQL databases) or the `mysql` command-line tool (for MySQL databases). The script contains instructions that are only supported when the script runs through these tools.

3. Start Media Server 12.7, and run training and analysis as normal.

_FT_HTML5_bannerTitle.htm