existing database [SQLChangeAutomation-Prod] on [SQL2K12] needs to be baselined prior to deployment
eliassal
Posts: 9 Bronze 1
HI, I have created a build definition in TFS, then a release definition (followed videos at https://www.red-gate.com/hub/university/sql-change-automation-with-sql-source-control-projects/automated-deployments-using-the-sca-tfs-vsts-extensions/defining-use-database-release-task).
The deployment fails with the following error:
Building patch for the [SQLChangeAutomation-Prod] database on [SQL2K12]...
[warning]RedGate.Versioning.Engine.Api.Exceptions.VersioningEngineConfigurationException:
The existing database [SQLChangeAutomation-Prod] on [SQL2K12] needs to be baselined prior to deployment
(a baseline is required to ensure that existing database objects are not affected during an initial SQL Change Automation project deployment).
See the following article for more information: https://www.red-gate.com/sca/dev/baseline. Alternatively, you can attempt to deploy without a baseline by specifying SkipBaselineCheck=True...
......
......
The project that is built by TFS isI created with SCA , dev DB is on localdb, and on Target server I created manually the initial DB with a suffix -Prod.
So how can I baseline the target DB as it is a Q/A environment and want tables and procs added to the dev go through my Release definition. In the video, the instructor does not mention anything about this.
2nd, in the error message it is indicated that I can attempt
you can attempt to deploy without a baseline by specifying SkipBaselineCheck=True
Where should I indicate this? in TFS or in the project in VS?
Thanks for your help
The deployment fails with the following error:
Building patch for the [SQLChangeAutomation-Prod] database on [SQL2K12]...
[warning]RedGate.Versioning.Engine.Api.Exceptions.VersioningEngineConfigurationException:
The existing database [SQLChangeAutomation-Prod] on [SQL2K12] needs to be baselined prior to deployment
(a baseline is required to ensure that existing database objects are not affected during an initial SQL Change Automation project deployment).
See the following article for more information: https://www.red-gate.com/sca/dev/baseline. Alternatively, you can attempt to deploy without a baseline by specifying SkipBaselineCheck=True...
......
......
The project that is built by TFS isI created with SCA , dev DB is on localdb, and on Target server I created manually the initial DB with a suffix -Prod.
So how can I baseline the target DB as it is a Q/A environment and want tables and procs added to the dev go through my Release definition. In the video, the instructor does not mention anything about this.
2nd, in the error message it is indicated that I can attempt
you can attempt to deploy without a baseline by specifying SkipBaselineCheck=True
Where should I indicate this? in TFS or in the project in VS?
Thanks for your help
Tagged:
Answers
If you are attempting to release to an existing database that currently has objects within it you would need to create a baseline as it says. I believe the page it links is the same as this one on workign with an existing database: https://documentation.red-gate.com/sca3/tutorials/worked-examples/working-with-an-existing-database
From what you say, it sounds like you have restored your Q/A database that has existing objects to a new database called SQLChangeAutomation-Prod and have an empty development database. The baseline wizard lets you create a baseline as shown in the documentation page, which will then be able to create these objects to the development database. Then your future changes are added on top of this and when you go to deploy to the database that already has the baseline it only runs the migrations for the new changes.
I hope that helps explain how it should work - if I've misunderstood something please let me know!
Kind regards,
Alex
Have you visited our Help Center?
What do you mean by a new database in an existing project? Can you outline the steps you are taking to get to the point where you are experiencing the issue? Why you would be adding another database to an existing SCA project?
If I have a SCA project and add another new SCA project (so two projects in one solution) it prompts me with the setup wizard where I can specify the baseline.
Kind regards,
Alex
Have you visited our Help Center?
https://forum.red-gate.com/discussion/84708/best-way-to-handle-starting-sca-project-from-existing-dev-db#latest
I was running into baseline issues, too.
-Peter
The discussion does not apply to me as I am using TFS for build and release pipeline I don't want to baseline for the time being, what is the use of baselining an empty DB? maybe later after 1st deployment by not now, this is ridiculous
1) uncheck "mark first folder as baseline" in the project settings.
2) add the "skip baseline check" flag to the project settings file by:
2a) right-click on the project file in solution explorer and select "unload project"
2b) right click on the unloaded project file and select "edit"
2c) in the first property group, add the following element:
<SlipBaselineCheck>True</SkipBaselineCheck>
2d) save the project file and close it
2e) right click the project file and select "load..."
Than you can use the powershell cmdlets to build and deploy. Any rogue objects in your target db might cause SCA to mark the first baseline script in your project as already deployed during the baseline check.
I found success with this. I also found success (alternatively) by discovering that my "empty" target db actually had a user that was in the model db. This user caused SCA to decide not to deploy the baseline script to my "empty" db. Removing that user from model and therefore from any new db I created allowed the project to successfully deploy to a new empty target without the "skip baseline check hack.
One of these options should work gro you.
I hope this is helpful rather than more confusing.
-Peter
Question for this forum, is there anyone who has expertise in TFS and how to use your tools with TFS?
Peter, this is exactly why I asked for someone who has experience with TFS config and not PowerShell, sorry for being rude q little bit as I am spending time, according to me should have been resolved in 5 minutes
First, thank you @PeterDaniels for your input - I think it covers the bases well.
As shown in Peter's other post - if you have just created a blank database and it's indicating you need to create a baseline, it's likely a similar situation where there was an object in the model database being created and making it seem to be user objects in the new database.
You would need to stop this or add these objects as the baseline so that they are ignored - or modify the SCA project to skip the baseline check as Peter also suggested.
The addons in TFS and other build/release systems use the PowerShell cmdlets behind the scenes (also as Peter pointed out) and the alternative would be if one were to use MSBuild on the project from Visual Studio (like was necessary when it used to be ReadyRoll).
If none of those options are what you want to do @eliassal then I'm there's not much else we can do to help. If you have tried those things and are still having issues or truly do not think that is the same issue, please send in screenshots and further explanation of what you are seeing including build logs to support @ red-gate.com and we can try to help out further
@GHood - If you are changing the connection to a database with a different set of starting objects, it's not appropriate to change the baseline so that it works with that new database; you should create a new project with a new baseline. The point behind the baseline is that it exists in the target you are deploying to so that you don't count those objects, but if you are deploying to a blank database it will create them; it shouldn't be changed to deploy to different starting points.
I think that covers it all to this point, but if I've missed something please let me know.
Kind regards,
Alex
Have you visited our Help Center?