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 statements to back up data, and validation statements used to determine whether the data fix should be committed or rolled back.

...

Code Block
languagexml
themeRDark
titleLine Item Fix
<?xml version="1.0" encoding="UTF-8"?>
<DataFix xmlns="http://flexagon.com/database/datafix">
    <Description>Fix line items for product IDs 47809 and 45203</Description>
    <FixSQL>update product_list set list_price = 100 where product_id = 47809;
			update product_list set list_price = 75 where product_id = 45203;
			update order_items set unit_price = 100 where product_id = 47809;
            update order_items set unit_price = 75 where product_id = 45203;</FixSQL>
    <BackupSQL>create table order_items_bkp as (select * from order_items);
			   create table product_list_bkp as (select * from product_list);</BackupSQL>
    <ConnectStringProperty>DATA_FIX_URL_PROPERTY</ConnectStringProperty>
    <UserProperty>DATA_FIX_USER_PROPERTY</UserProperty>
    <PasswordProperty>DATA_FIX_PASSWORD_PROPERTY</PasswordProperty>
    <Validations>
        <Validation>
            <Description>Verify number of rows modified for product with id 47809</Description>
            <ValidationSQL>select count(*) from order_items where list_price = 100 and product_id = 47809</ValidationSQL>
            <Environment>
                <EnvironmentCode>DEV</EnvironmentCode>
                <UpdateCount><After>
                    <GreaterThan>80</GreaterThan>
                    <LessThan>100</LessThan>
                </UpdateCount>After>
            </Environment>
            <Environment>
                <EnvironmentCode>default</EnvironmentCode>
                <UpdateCount><After>
                    <GreaterThan>87</GreaterThan>
                    <LessThan>93</LessThan>
                </UpdateCount>After>
            </Environment>
        </Validation>
        <Validation>
            <Description>Verify number of rows modified for product with id 45203</Description>
            <ValidationSQL>select count(*) from order_items where list_price = 75 and product_id = 45203</ValidationSQL>
            <Environment>
                <EnvironmentCode>default</EnvironmentCode>
                <UpdateCount><After>
                    <GreaterThan>120</GreaterThan>
                    <LessThan>125</LessThan>
                </UpdateCount>After>
            </Environment>
        </Validation>
		<Validation>
            <Description>Verify total number of rows modified for product with id 45203<modified</Description>
            <ValidationSQL>select count(*) from order_items where list_price = 75 and product_id = 45203<<ValidationSQL></ValidationSQL>
            <Environment>
                <EnvironmentCode>default</EnvironmentCode>
                <UpdateCount>
                    <GreaterThan>120<<GreaterThan>200</GreaterThan>
                    <LessThan>125<<LessThan>220</LessThan>
                </UpdateCount>
            </Environment>
        </Validation>
    </Validations>
</DataFix>

...