Colourblind

Welcome to Colourblind.

This is the personal web space of Tom Milsom. As much as possible everything is free (as in speech and as in beer).


Make text: Smaller Bigger

Compares Favourably and NAnt, BFF

Posted by Tom on 23/06/2010 16:00:38

The original plan for Compares Favourably was to integrate it with our build and deployment process. This means we would be alerted to any differences in the database schema between dev and staging or staging and live at each release. In the end I got sidetracked into learning WinForms and to be honest I probably get more use out of the app because of it. However, my original problem still remains - if we do a release with an out-of-date database schema things break. Pages yellowscreen. Clients cry. Burning sulphur rains from the heavens. Around the world albino bulls are born and explode, killing all in the blast radius. It's pretty bad, and completely avoidable.

We use NAnt for builds, and since there is a command line front end for Compares Favourably I could just use <exec>, dump the output to a file and then parse it, but that seems a little bit pedestrian. Especially when the fine people responsible for NAnt make it so easy to write plugins.

As of revision 48 the ComparesFavourably NAnt task is in the SVN repository. In order to use it from a NAnt build script you will need to do one of the following:

  • Copy the ComparesFavourably.Nant, ComparesFavourably.Engine and Colourblind.Core assemblies into your NAnt /bin/ folder
  • Use NAnt's loadtasks task to load the plugin explicitly.

Once that's done you can run Compares Favourably from within NAnt using the following:

<ComparesFavourably 
    settingsfile="..\etc\SampleProjectFile.cmp" 
    resultproperty="result" 
    verbose="false" 
    failondifferences="false"
/>

Here's a brief explanation of the properties.

Property Type Required Default Description
settingsfile string true N/A This is a path to the Compares Favourably project file to use for the comparison
resultproperty string false N/A The name of the property to fill place results in. The result is a bitfield with bit 0 set if there are differences, bit 1 set if items exist in left but not right, and bit 2 set if items exist in right and not left. So a result of 5 shows that some items are different and others are in the destination database but not the source.
failondifferences bool false false Throw a build error there are any differences as a result of the comparison
verbose bool false false Use this property to output more detailed information as the task runs

I'll do a follow-up post later in the month about how to actually write custom NAnt tasks, but if you're impatient then you can get the code right this very moment in the Subversion repository. Instant gratification!

Questions? Bugs? Comments? Feature requests? I am available on the Internets.

Comments (0)

Compares Favourably - Now with more stuff

Posted by Tom on 16/05/2010 11:17:18

Things have been gently ticking over on Compares Favourably, so here's an update.

<Insert source-related pun here>

First things first: it's become abundantly clear that I'm far too tardy to maintain a decent release schedule. This last set of changes have been languishing in the the SVN repository for months but I've simply been too slack to package everything up. With that in mind I'm opening the repo up for reads.

http://svn.xp-dev.com/svn/Colourblind_ComparesFavourably

It's fairly stable. There's VS2008 project and solution files and NAnt build scripts and automated tests (NUnit) are run before every commit but the test coverage isn't great and building doesn't mean working. The command line front-end in particular tends to lag behind. That said I'm lazy about releases, so I believe SVN is the place to be if you want the good stuff.

New features!

The code generation has much better feature coverage now. Since the last release the following has been added:

  • Triggers
  • Check constraints
  • User defined types
  • Compound foreign keys
  • Various index features
  • Grants on tables

The latest revision also includes a few UI bug fixes.

Want more?

Demanding, ain't cha?

I'm not sure what to add next. It'll probably be SQL Server 2008 support. I've had a brief play around with the new SMO assemblies and they seem to have fixed some of the performance SNAFU - which may make all my DDL code redundant, but hey, thems the breaks. Beyond that if there's anything you want it to do that it doesn't, please let me know.

Comments (0)

Introducing Compares Favourably

Posted by Tom on 24/12/2009 12:23:06

So I made a database schema comparison tool for MSSQL 2005.

Compares Favourably

Compares Favourably

It started out as a hobby project since I saw SMO and assumed it would be simple to make something that would freak out if we tried to push a staging release to live without first getting the database structure the same. Turns out SMO is a whole bus-load of fail for churning out large amounts of DDL, so I started writing my own DDL generation code. Then I put a simple UI over the top of it because I was curious about WinForms, and it started growing from there.

You can download the source as well (static downloads, rather than repository since my build discipline is pants and half the time it doesn't even compile), which I'm releasing under the <shrug/> licence, also known as the Meh, Whatever PL. If you can find a use for it then you're more than welcome, but please let me know - I'm curious if the code ends up anywhere cool.

In other news best Christmas #1 ever.

Comments (0)