VSTS deploy fails with "No schema snapshot could be retrieved from the target database"
This is an Azure deployment.
Thanks,
- Mark
- Attached: log of error messages I receive during deployment.
- Attached: Release configuration
- Attached: Build configuration
- Attached: Project Debug Properties.
- Attached: Project target platform
Thanks,
- Mark
Tagged:
Best Answer
-
MikielAgutu Posts: 29 Silver 1Hello
This warning is common, usually seen on your first deployment since there is no snapshot on the target database. Unless you have told VSTS to fail the deployment on warnings then this shouldn't present any issues. The mention of the shadow server is to ensure the snapshot is actually created during build. As far as I can see your build configuration is correct.
The actual problem seems to be something wrong in your baseline migration script. In the log you can see (from line 19):##[warning]C:\Users\VssAdministrator\AppData\Local\Temp\DLM Automation\cejzu05d.04o\Migrations\1.0.0-Baseline\001_20180730-1608_Baseline.sql: An error occurred while attempting to deploy project scripts:##[warning]Msg 2714, Level 16, State 6, Server phsa-csbc-pcr-test-sql, Line 2##[warning]There is already an object named 'defn' in the database.##[warning]Msg 2759, Level 16, State 1, Server phsa-csbc-pcr-test-sql, Line 2##[warning]CREATE SCHEMA failed due to previous errors.
It seems the baseline script cannot be deployed because the 'defn' object already exists. Can you check if the MigrationLog table exists on your deployment target. If it does try deleting it, then deploying again with VSTS. If that doesn't work can you check the .sqlproj file to see if the 'Baselining' setting is set to 'FolderBased'.
ThanksMikiel Agutu | Software Engineer | Redgate Software
Answers