Upgrade Scripts

Data model upgrade scripts are a crucial part of database-based applications. Standards help to ensure that upgrade scripts behave correctly and consistently. These helps save time in development, maintenance, and support.

When to write an upgrade script

Anytime that a change is made to a component's sql creation script that results in a different schema and/or data set, an upgrade script should be written that, when applied to the previous creation script, results in the same schema and data set.

Operation Details

Every component should have exactly zero or one upgrade script per release per supported database. However, an upgrade script may source other files.

Upgrade scripts go in an /upgrade directory below the directory containing the corresponding creation script. The name of the file should be <component-name>-<old-version-name>-<new-version-name>.sql.

Example:
cms/sql/oracle-se/upgrade/cms-4.6.4-4.6.5.sql
      

Extending this process farther, there should be a single upgrade script for all of Red Hat Web Application Framework per version. This upgrade script lives in kernel/sql/oracle-se/upgrade and is called core-platform-<old-version-name> -<new-version-name>.sql. Like core-platform-create.sql, this script will not have its own SQL commands, but will simply source other files. Updating this script is the responsibility of each component developer.