Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

XML files containing one or more data fix sql statements, a sql statement to back up data, XML files containing one or more data fix sql statements, a sql statement to back up data, and validation statements used to determine whether the data fix should be committed or rolled back.

Object Type Identification

...

NameCodeDescriptionDefault Value
Data Fix Root Source DirectoryFDEBS_DATA_FIX_ROOT_SOURCE_DIRThe source directory to recognize files as data fixesdatafix
Data Fix Root Destination DirectoryFDEBS_DATA_FIX_DESTINATION_DIRThe destination directory to copy file to.  Leave blank to not copy file anywhere

Related Environment Instance Properties

NameCodeRequiredDescription
JDBC Driver PathFDEBS_DRIVER_PATHYesLocation of JDBC driver file required only for running data fix files. For example, /u01/app/oracle/product/12.1.0/dbhome_1/jdbc/lib/ojdbc6.jar

Sample Build Commands 

N/A - Build commands not supported for this type.

...

N/A - Deploy commands not supported for this type.

Data Fix Source Formatting

...

XML Schema

Info

Elements without min/max occurrences listed have the default values for cardinality, which are minOccurs="1" and maxOccurs="1"


Code Block
languagexml
themeRDark
titleData Fix XML Schema (XSD)
linenumberstrue
<?xml version="1.0" encoding="windows-1252" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://flexagon.com/database/datafix" targetNamespace="http://flexagon.com/database/datafix" elementFormDefault="qualified">
  <xsd:element name="DataFix">
    <xsd:annotation>
      <xsd:documentation>Data fix object</xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:all>
        <xsd:element type="xsd:string" name="Description"/>
        <xsd:element type="xsd:string" name="FixSQL"/>
        <xsd:element type="xsd:string" name="BackupSQL"/>
        <xsd:element type="xsd:string" name="ConnectStringProperty" minOccurs="0" maxOccurs="1"/>
        <xsd:element type="xsd:string" name="UserProperty" minOccurs="0" maxOccurs="1"/>
        <xsd:element type="xsd:string" name="PasswordProperty" minOccurs="0" maxOccurs="1"/>
        <xsd:element name="Validations">
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="Validation" minOccurs="1" maxOccurs="unbounded">
                <xsd:complexType>
                  <xsd:sequence>
                    <xsd:element type="xsd:string" name="Description"/>
                    <xsd:element type="xsd:string" name="ValidationSQL"/>
                    <xsd:element name="Environment" minOccurs="1" maxOccurs="unbounded">
                      <xsd:complexType>
                        <xsd:all>
                          <xsd:element type="xsd:string" name="EnvironmentCode"/>
                          <xsd:element name="Before" type="Operators" minOccurs="0" maxOccurs="1"/>
                          <xsd:element name="After" type="Operators" minOccurs="0" maxOccurs="1"/>
                          <xsd:element name="UpdateCount" type="Operators" minOccurs="0" maxOccurs="1"/>
                        </xsd:all>
                      </xsd:complexType>
                    </xsd:element>
                  </xsd:sequence>
                </xsd:complexType>
              </xsd:element>
            </xsd:sequence>
          </xsd:complexType>
        </xsd:element>
      </xsd:all>
    </xsd:complexType>
  </xsd:element>
  <xsd:complexType name="Operators">
    <xsd:all>
      <xsd:element name="Equals" type="xsd:int" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="NotEquals" type="xsd:int" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="LessThan" type="xsd:int" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="LessThanEqual" type="xsd:int" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="GreaterThan" type="xsd:int" minOccurs="0" maxOccurs="1"/>
      <xsd:element name="GreaterThanEqual" type="xsd:int" minOccurs="0" maxOccurs="1"/>
    </xsd:all>
  </xsd:complexType>
</xsd:schema>

Details of data fix elements are described in the table below. 

ElementPathXSD Line NumberDescription
DataFix/3The root element for the data fix
Description/DataFix9A description for the data fix being run
FixSQL
Yes
/DataFix10The SQL which implements the data fix. It can be multiple statements delimited by a semicolon or slash
BackupSQL/DataFix
Yes
11

SQL to perform necessary backup of data before executing FixSQL. This must be one valid SQL statement, not followed by a semicolon

Tip

Include ${{FD_PROJECT_VERSION}} in the title of your backup table to easily identify it after execution


ConnectStringProperty
No
/DataFix12The JDBC connection string for the database.
The
 The APPS_JDBC_URL environment variable will be used if
property is
not specified in file
UserProperty/DataFix
No
13User to connect to database with.
 
The object attribute will be used if property is not specified in file
PasswordProperty
No
/DataFix14Password for the database user.
 The
 The object attribute will be used if property is not specified in file
Validations
YesYes
/DataFix15The rule(s) used to validate the data fix before committing changes
       Validation
Validation/DataFix/Validations18A single validation rule
. See below for more details

A single validation contains the following:

Tag NameRequired
Description
DescriptionYes
/DataFix/Validations/Validation21A description for the validation rule
ValidationSQL
Yes
/DataFix/Validations/Validation22Select query which is executed before and after the FixSQL is executed, and result is compared with before and after values. This must be one valid SQL statement, not followed by a
semicolonEnvironmentYes
semicolon
Environment/DataFix/Validations/Validation23The expected results defined by an environment
. See below for more details

An environment contains the following:

Tag NameRequiredDescriptionEnvironmentCodeYes
EnvironmentCode/DataFix/Validations/Validation/Environment26FlexDeploy environment code, or DEFAULT to apply to any deploy environment not explicitly specified
Before
No
/DataFix/Validations/Validation/Environment27Contains results to check before FixSQL is executed
After
No
/DataFix/Validations/Validation/Environment28Contains results to check after FixSQL is executed
UpdateCountNo
UpdateCount/DataFix/Validations/Validation/Environment29Results to compare return of JDBC executeUpdate() of FixSQL. If the FixSQL contains more than one statement, it is the sum of the updated rows

The Before, After, and UpdateCount elements may contain one or more of the following operators to compare the result:

  • Equals
  • NotEquals
  • LessThan
  • LessThanEqual
  • GreaterThan
  • GreaterThanEqual

...

OperatorsN/A42Complex type containing list of accepted operators to be used in validations

Data Fix Source Template

Code Block
languagexml
themeRDark
titleBasic Data Fix Template
linenumberstrue
<?xml version="1.0" encoding="UTF-8"?>
<DataFix xmlns="http://flexagon.com/database/datafix">
    <Description></Description>
    <FixSQL></FixSQL>
    <BackupSQL></BackupSQL>
    <ConnectStringProperty></ConnectStringProperty>
    <UserProperty></UserProperty>
    <PasswordProperty></PasswordProperty>
    <Validations>
		<!-- Can be one or more -->
        <Validation>
            <Description></Description>
            <ValidationSQL></ValidationSQL>
			<!-- Can be one or more -->
            <Environment> 
                <EnvironmentCode></EnvironmentCode>
                <Before>
                    <Equals></Equals>
                    <NotEquals></NotEquals>
                    <GreaterThan></GreaterThan>
                    <GreaterThanEqual></GreaterThanEqual>
                    <LessThan></LessThan>
                    <LessThanEqual></LessThanEqual>
                </Before>
                <After>
                    <Equals></Equals>
                    <NotEquals></NotEquals>
                    <GreaterThan></GreaterThan>
                    <GreaterThanEqual></GreaterThanEqual>
                    <LessThan></LessThan>
                    <LessThanEqual></LessThanEqual>
                </After>
                <UpdateCount>
                    <Equals></Equals>
                    <NotEquals></NotEquals>
                    <GreaterThan></GreaterThan>
                    <GreaterThanEqual></GreaterThanEqual>
                    <LessThan></LessThan>
                    <LessThanEqual></LessThanEqual>
                </UpdateCount>
            </Environment>
        </Validation>
    </Validations>
</DataFix>

...