Adjusting migration script after failure when Applying Changes
darber
Posts: 1 New member
I am applying changes to my local database and the Apply Changes fails due to an issue with a migration script. (Specifically, the script includes a 'Use dbName' that differs from my local version's db name)
In the past, there was the ability to open migration script open from the failed apply changes window. This would open the migration script in a new tab where I could make an adjustment (i.e. change 'use dbname' to 'use local_dbname'), then run it and upon closing the tab, the Apply Changes process would continue.
This option is no longer available, or at least not that I can find. Does anyone know if this is still possible?
I am running SSMS 18.4 and Source Control 7.0.44.9821
In the past, there was the ability to open migration script open from the failed apply changes window. This would open the migration script in a new tab where I could make an adjustment (i.e. change 'use dbname' to 'use local_dbname'), then run it and upon closing the tab, the Apply Changes process would continue.
This option is no longer available, or at least not that I can find. Does anyone know if this is still possible?
I am running SSMS 18.4 and Source Control 7.0.44.9821
Tagged:
Answers
Thanks for reaching out and sorry that you're having trouble with SQL Source Control. Would you happen to recall in which version you had the option to modify the migration script from the failed 'Apply Changes' window? I looked through our documentation and couldn't find when this changed. You can edit the migration by clicking on the migrations tab and select view/edit on the migration script you're getting the error from, however, after testing this locally, I don't believe this will help your issue. We don't believe the use statement makes sense for SQL Source Control because the scripts folder can be used against any database. We actually removed the option to add a database use statements for this reason.
Would it be possible to remove the use statement from the script all together? Please keep in mind, once you modify the script you have to commit it before you can apply the change.
I hope this helps. Please let me know if there are any further questions.
Kind regards,
Pete Ruiz