Deploy database packaing for custom script not working

akhilgarg81akhilgarg81 Posts: 8
edited September 26, 2014 8:47AM in Deployment Manager
Hi Team,

I have linked my database to TFS source control. Using SQLCI Build and publish command i am able to create a package of sql script which are in TFS. Using RedGate Deployment Manager i am able to deploy this package to database.

Now in TFS i have created a folder "CustomScript". In this folder i have added some custom script to insert,update and delete rows in a table.

I am able create package of these all scripts (including custom script) and publish.

Using RedGate Deployment Manager i am able to deploy this package to database. After deployment when i verified my changes on database i am not seeing changes of my custom scripts. Custom script was not executed.

I tried with "RedGateDatabaseAllowDynamicUpgrade" option set to "False" than i am getting below error

Could not upgrade: no upgrade script for current version 07.22.05.10 was found and dynamic upgrade is disabled (you can enable it in the database package step options by setting "Allow dynamic upgrades" to "Yes")

My objective is i want to include some custom script in my package and want to deploy using Deployment manager.

Comments

  • Hi Team,


    Please reply on this issue or we can setup a call. This is very urgent i have stuck mid way to setup sql packaging and deployment.

    Thanks
    Akhil
  • Scripts defined outside of our source control product are supported but - they can only be deployed using our pre/post deploy powershell script mechanism. Please take a look at look at the following information which describes how to use these scripts in your package:

    http://documentation.red-gate.com/displ ... deployment
  • Hi Team,

    I am using PreDeply.ps1 powershell script to execute some custom script.
    Using RedGate Deployment Manager i am deploying this package to 4 different server.

    I want this PreDeply.ps1 powershell script to run only once not for all four server.

    Please let me know how can i configure this.

    Thanks
    Akhil
  • Hi Team,

    I am waiting for your reply. Please respond ASAP.

    Thanks
    Akhil
  • Hi Akhil

    Sorry for the delay in getting back to you.

    If I understand your problem correctly, you want to deploy a package to four different servers but only run a custom script in that package once.

    You can create another NuGet package containing only the preDeploy script. Then you would need to modify your Deployment Manager project and add a new step before the deployment step.

    In the new step, you can select the new NuGet package to deploy the custom script. There is also an option to choose deploy machines when you create a step. If you choose, just one machine then Deployment Manager will only run this script once (on the machine you chose).

    Hope this helps!

    Chirayu
    Chirayu Shishodiya
    Software Engineer - Deployment Manager
    Red Gate
  • Hi Team,

    I am using PostDeploy.ps1 powershell script to call a batch file. I tried to pass some variables from Deployment Manager and access in power shell.

    I tried getting variable value using $BuildEnvironment and i tried this way

    $DeploymentManagerParameters["BuildEnvironment "] but not working.

    Please help me on this.

    Thanks
    Akhil
  • Hi team

    I am waiting for your reply. Please response ASAP.

    Thanks
    Akhil
  • Sorry about the late reply. This ticket does not actually show up in Zendesk (our customer support software) and did not get dealt with.

    If you have created a BuildEnvironment variable in Deployment Manager, you should be able to reference its value in your PowerShell scripts by using $BuildEnvironment notation.

    You can also reference it using $DeploymentManagerParameters["BuildEnvironment"] notation. Note: that this method is case-sensitive, so if the variable is called buildEnvironment in Deployment Manager it won't actually work.

    Also, I noticed a trailing space after BuildEnvironment in your post earlier. Maybe that is the reason why it is not working for you? Or it might be to do with the case-sensitiveness as explained above.

    Chirayu
    Chirayu Shishodiya
    Software Engineer - Deployment Manager
    Red Gate
Sign In or Register to comment.