schambers/fluentmigrator — pull request #462 by mstancombe (2014-01-03 05:02:13+00:00)
Title: New DefaultExistingRowsTo fluent command

Hi,

Just used Fluent migrator for my own project, worked great :D

The first thing I did was try add a non nullable column and assign those to existing values. I saw on the wiki that there is already a way to do this using 3 commands (ie, by adding column as nullable, assigning, then setting non nullable), and thought it would be nice to just do it in one line, so here it is :)

While in there, I noticed that there is some duplication for a few functions between the various expression builders which handle columns, noteably, AlterColumn, CreateColumn, AlterTable and CreateTable. When adding the existing row default stuff, i've added a common helper, so the logic for it is centralised, and only has to be tested once. Have also refactored the IsNullable and Unique calls to use this central class, and modified their tests accordingly. Feel free to give any feedback/criticism that is required. There were a few things that I wasn't sure what was best practice, but pragmatically, I did it anyway. :)

I don't have drivers for some of the providers, so not all the tests passed for me, so let me know if I've broken anything.

(and sorry.. i added a vs2013 solution and checked it in with the change, not seperately :$ )

Cheers -Mike