Migration deployment from custom desktop app
bitman
Posts: 8 New member
Hello,
I have a desktop application and during loading I check for any updates from our server. I want to ask if there is a way to also deploy the migrations I will generate using SCA to my target database? I mean, does the project I created in SCA sufficient to be an executable application for migration deployment? Or I need to move the migration files inside my application and run it from there? Sorry for a rookie question but if there is a solid solution already, I would rather use that instead of reinventing the wheel.
Thank you very much.
I have a desktop application and during loading I check for any updates from our server. I want to ask if there is a way to also deploy the migrations I will generate using SCA to my target database? I mean, does the project I created in SCA sufficient to be an executable application for migration deployment? Or I need to move the migration files inside my application and run it from there? Sorry for a rookie question but if there is a solid solution already, I would rather use that instead of reinventing the wheel.
Thank you very much.
Tagged:
Answers
To deploy a SQL Change Automation project, the process we recommend flows like this:
- Run a successful build for the code you want to deploy. This outputs an artifact in the form of a NUGET package.
- Deployment is a two step process:
- A. Create a release artifact using the NUGET package from the build and setting the target database. This looks at what has been deployed so far to the target database and also can evaluate things like whether drift has occurred since your last deployment.
- B. Deploy the release artifact to the target database. If you are sure that all target databases will be the same and are not concerned about drift, it is possible to create a release artifact against one database, and then deploy it to as many target databases as needed.
All of the steps above can be done using PowerShell. (References here have good examples: New-DatabaseReleaseArtifact, Use-DatabaseReleaseArtifact)To dig into your question, the NUGET package from the build does essentially contain a copy of the migration files from the project. So this process is, essentially, moving the migration files for you. But it also adds significant functionality on top of that, like checking which migrations have already been run against the target, running the migrations in the same order as has been tested in the verify and build process, etc.
Hope this helps,
Kendra