Project

General

Profile

h1. Embedding of upgrade SQL instructions to packages.

Subrion CMS supports execution of SQL queries when upgrading package's version to the newer one.
The version attribute is optional and can be omitted. If omitted, the script will execute it independently on the current and newer versions. If specified, the query will run only when upgrading from the version specified.
Again, if you specify the version attribute, Subrion CMS will execute it only for the marked version, otherwise, it will be executed during every upgrade.

See the example below.

<!-- WILL RUN ON THE SCRIPT UPGARDE FROM THE 1.0.0 TO THE NEXT VERSION --><![CDATA[
ALTER TABLE {prefix}myentries CHANGE category_id entry_id smallint(5) UNSIGNED NOT NULL
]]>
<!-- WILL RUN EVERY TIME --><![CDATA[
SELECT NOW()
]]>

It is highly recommended the upgrade instructions to be placed as the latest instructions set in the package's install.xml file.