Skipping Schema Scripts
Overview
Skipping Schema Scripts mechanism avoids redundant processing, for example, skipping script execution if the same script has already been run, and thus prevents errors during system updates. It is based on the same approach disregarding the product type (a standard system update or installation of an Extension), it is run at any update phase (Preparation, Maintenance, or Post) and applies to all types of Schema Scripts with only differences in their configuration.
Skipping Schema Scripts mechanism is introduced in DWP v.12.1.1.
This configuration is optional and consists of manually adding a condition to the Schema Script file. The condition is checked when the script is executed in the update process. The script will be registered in the SchemaScripts
database table even if it is not executed.
Configuration
XML Schema Scripts
For Schema Scripts that have an XML file structure (.class, .type, .relation, .del, etc., see Schema Scripts page), add a SkipCondition
attribute at the root node:
<?xml version="1.0" standalone="yes"?> <NewDataSet SkipCondition="Select * from dbo.schemaobjectClass where id='9226486b-d7f0-4fd0-b667-da14a2a11487'"> <BasicSchemaObjectClass> <ID>9226486b-d7f0-4fd0-b667-da14a2a11487</ID> <Name>TestClass</Name>...
In the condition, specify a Select SQL query that may return rows. If any rows are returned the script is skipped, however, the script will be registered in the SchemaScripts database table even if it is not executed.
Non-XML Schema Scripts
For Schema Scripts that contain plain SQL (e.g. .post scripts), add an SQL comment in the first line of the script, for instance:
--SkipCondition:Select * from dbo.schemaobjectClass where id='9226486b-d7f0-4fd0-b667-da14a2a11487' update TestClass set StringAttribute='skipped from post' where id='{27EF754A-45B9-47B2-85A3-29530AB41550}'
In the condition, specify a Select SQL query that may return rows. If any rows are returned the script is skipped, however, the script will be registered in the SchemaScripts
database table even if it is not executed. If the condition applies, the whole script is then skipped even if it has different sections with GO
statements.