Reputation: 43
I am trying to get Azure Devops to run a SQL migrate script as part of deployment / release to a .net core staging site. I have included the sql script in the solution, outside of the wwwroot folder. The build artefact is created and the release happens to the azure website, but the 'Azure SQL Publish' task, as part of the release, cannot find the SQL file and fails. How do you specify the Azure SQL Publish SQL script ?
In the website publish task before the SQL publish task, I can see the migrate.sql file being copied to the staging site, in the logs.
Info: updating file (site-name)\SQLMigrations\migrate.sql
So, a file has been deployed.
When the SQL publish task runs, I cannot seem to specify the correct location to execute the script against the azure SQL server database.
I currently have '**\migrate.sql' as the script pattern / path. Thinking this might pickup any file called migrate.sql. I have tried using some of the $(environment variables) to point to the root, but still have not managed to find the correct path.
Upvotes: 2
Views: 302
Reputation: 43
I needed a second 'Publish Artifact' task, at the end of the normal build tasks, that was looking at a folder in the source repo, and took its contents and published to a different artifact name ... 'SQLDrop' ... rather than 'drop' that was being used for the website build. Then on the release side of things, I used the 'Azure Database Deploy' task to look at SQLDrop for any sql files, and execute them.
Upvotes: 1