I do not want SQL scripts to be executed when automatic uninstall happens because a major upgrade removes existing products.
The problem is that I have the database user name and password passed as a command line parameter, so when it does the upgrade and automatically runs the uninstall it tries to execute the SQL scripts, but there is not database username or password, so the upgrade then fails. You can see in SQL Profiler that the username is set to '' (blank).
My component code is as follows:
<Component Id="SQL" Guid="AF267662-23A0-4b46-B490-C11465BE9858" KeyPath="yes" >
<Condition>NOT UPGRADINGPRODUCTCODE AND NOT REMOVE="ALL"</Condition>
<!--UNINSTALL-->
<sql:SqlScript Id="Uninstall.SQLScript" ExecuteOnInstall="no" ExecuteOnUninstall="yes" BinaryKey="SQLScript.Uninstall" User="SQLUser" SqlDb="SqlDatabase" Sequence="1"/>
<!--INSTALL-->
<sql:SqlScript Id="SQLScript2" ExecuteOnInstall="yes" ExecuteOnUninstall="no" BinaryKey="SQLScript.Create.DBObjects" User="SQLUser" SqlDb="SqlDatabase" Sequence="3"/>
</Component>