Provide steps to troubleshoot Pre-Update schema check failed errors.
This error can occur when Deploying a Database Release (which corresponds to the Use-DatabaseReleaseArtifact if using Powershell)
On this step SQL Change Automation attempts to deploy an update script generated on the Create Database Release step (corresponds to New-DatabaseReleaseArtifact).
Since there might be a time delay between script creation and deployment and also because the script can be applied to a different target than the one that was used in the Create Database Release step, a pre-update schema check is carried out before the script is applied.
The pre-update schema check compares the scripts folder States/Target in the Deployment Resources with the Target Database using SQL Compare and originates the error if the scripts folder is not identical to the Target Database
This check compares both the schema and static data.
How to access the database deployment resources
- Powershell - Use the Export-DatabaseReleaseArtifact cmdlet
- Octopus Deploy template - The location is set on the Create Database Release step (Export path parameter)
- VSTS - You can access these if you are using a Private agent and you can set the location in the Export path parameter
Check the logs/console output
At the default logging level you will not get enough information to pinpoint the exact cause, however you can increase the level of the log/console output
At the start of your script add:
$DebugPreference = 'Continue'
$VerbosePreference = 'Continue'
- Octopus Deploy template
Edit the template and add the same variables listed above for Powershell
On your release definition, add a process variable named system.debug and set its value to true