Friday, July 15, 2016

Performing database deployments using AliaSQL

Most continuous integration build processes have a need to perform database deployments over the course of development, which is why a tool such as AliaSQL arose to fulfill that need!

You can find out about AliaSQL from here:

AliaSQL is available for download directly as an executable or can be installed via a NuGet package.

Once you download the tool, you will probably want to learn how to use it, so you should check out the "Getting Started" guide here:

If you want to look at a demo project, you can find that here:

While I was working with AliaSQL, however, I found a problem in the samples that were provided in the Getting Started Guide:

AliaSQL.exe Update .\sqlexpress Demo ./scripts

First of all, the example assumes that you have SQL Server Express installed.  Fortunately, the name of the database server can just as easily be substituted as follows:

AliaSQL.exe Update SQL2014Svr Demo ./scripts

But what about remote SQL Server instances?  What do you do then?  Thankfully, a solution for that is also available:

AliaSQL.exe Update SQL2014Svr Demo ./scripts mysqluser mysqlpassword

Lastly, I could never get this command to work!!  So what was wrong?  Well, even though the AliaSQL.exe file is placed in the root of the scripts directory, the path that is used in the command assumes that AliaSQL resides OUTSIDE of the scripts directory!!  This was fixed by using the following command instead:

AliaSQL.exe Update SQL2014Svr Demo . mysqluser mysqlpassword

Notice that I no longer reference the relative path to the ./scripts directory and simply assume that the AliaSQL.exe exists at the root of the scripts directory (as follows the pattern in the demo and the KickStarter project).

That was all that was needed for working with AliaSQL to do my database deployments!

For your reference, I have also provided a sample PowerShell script on doing database deployments using AliaSQL:

No comments:

Post a Comment