I have a pre-existing sql-azure db and an azure-website setup which is automatically deployed with each bitbucket push. Now I would like to run some .sql scripts I have in a specific folder in a specific order with each deploy as we make changes to the db each release. How would I go about doing this in Azure?
I've read this guide: https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script, and I understand that there's a deploy.cmd file generated when running azure-cli command that I need to modify. Just wondering what to add in there for sql changes. I already have a connection string for the sql azure db containing the username and password that I can use. Just need to know how I can actually execute these scripts against the sql azure db. Specifically following steps:
- Connect to sql azure db using the connection string
- Look in a specified folder for sql scripts and:
- Run the sql scripts in a specific order (they start with numbers e.g.: 015script.sql, 016script.sql)
- Some sort of error output if something failed.