Provide steps to troubleshoot Post-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 will deploy an update script generated on the Create Database Release step (corresponds to New-DatabaseReleaseArtifact).
After the update is deployed SQL Change automation compares the scripts folder States/Source in the Deployment Resources with the Target Database using SQL Compare and outputs this error if the scripts folder is not identical to the Target Database.
This check compares both the schema and static data.
Changes aren't rolled back when this error occurs.
How to access the database deployment resources
Since the changes aren't rolled back, comparing the States/Source folder in the deployment resources with the Target Database is a very effective way of troubleshooting. If you have static data, bear in mind that you will have to use the SQL Compare command line tool and use the /include:staticdata parameter.
- 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