Hi,
My understanding is that SCA uses sqlcmd to execute the migrations scripts.
In these migrations scripts, there is a parameter (variable) $DatabaseName.
Is there a way for me to have my own set of parameters/variables that I would pass from my powershell script to the migration script?
Regards,
Eric Lamontagne
Comments
4 comments
-
Hi Eric,
Yes, please see https://documentation.red-gate.com/sca/developing-databases/concepts/advanced-concepts/variables for more information regarding this.
Kind Regards, -
Hello Sergio,This is what I was looking for, thank you very much.On the other hand, I can't find how to SET the value of a variable at deployment time... can you tell me how it can be done?Thanks,Eric Lamontagne
-
Hi,
For deployment, if you are using the PowerShell cmdlets directly, see example 6 here: https://documentation.red-gate.com/sca/reference/powershell-cmdlets/new-databasereleaseartifact
If you are using the SQL Change Automation release plugin for Azure DevOps or the SQL Change Automation step templates for Octopus deploy, any environment variables you define will automatically be passed in as SQLCmd variables.
All the best,
Ivo Miller -
Great, thank you!
Add comment
Please sign in to leave a comment.