Troubleshooting issues with upgrading obfuscated database to v6
Scenario
You have taken a PentanaAudit database that has been obfuscated via our script, and attempted to upgrade it. At the v5.4 – v6.0 stage, App Manager fails with the error:
The procedure, AddSystemSettings1, returned errors
The exception reported is:
Violation of PRIMARY KEY constraint ‘PK_SystemSetting_Log_Version’. Cannot insert duplicate key in object ‘dbo.SystemSetting_Log_Version’. The duplicate value is (1).
Cause
The database was obfuscated using a very early version of the obfuscation script. The first releases truncated the _log tables leaving the _log_version tables intact. This becomes a problem with the v6 upgrade as it makes a change to the SystemSetting table, and when adding a row to SystemSetting_log it tries to re-use the ID for adding to SystemSetting_log_version, conflicting with an existing record.
Solution
While it seems a reasonable idea to:
DELETE FROM SystemSetting_Log_Version;
. . . and try again, further errors will occur in subsequent parts of the upgrade.
Therefore the solution is to redo the obfuscation against a fresh copy of the database, using the latest version of the script.