Migration deployment from custom desktop app

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.
Tagged:

Answers

  • Kendra_LittleKendra_Little Posts: 139 Gold 3
    edited December 14, 2020 12:10PM
    Hello,

    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 
    -------------------------------
    @Kendra_Little
    Product Manager at Redgate
  • way0utwestway0utwest CO, USA Posts: 307 Rose Gold 1
    To add to what Kendra notes, we typically create the artifact, by looking at the target and project and finding the differences. If you can't see the client dbs, this becomes more complex, but you can do this with PoSh and our cmdlets. Just note that if the client has changed anything in the db, your migration scripts, might have issues.

  • Kendra_LittleKendra_Little Posts: 139 Gold 3
    edited December 15, 2020 2:00PM
    One follow up on this -- if you're having issues getting this set up, consider opening a ticket with our support team. They're excellent and if you hit some hurdles, opening a ticket with them can help you move forward quickly. More info on contacting them is at Support (red-gate.com)  -- scroll down and there's a gray bar with all the contact methods.
    -------------------------------
    @Kendra_Little
    Product Manager at Redgate
Sign In or Register to comment.