Fixes an issue with sorting migrations

When sorting migrations, migrations following an incrementing value
numbering scheme will run into issues when there are more than 9
migrations. Using an alphanumeric sorting scheme leads to situations
where the migration labeled "10_alter_table.sql" will not be run because
it is assumed to have run before the migration "1_create_table.sql".

This patch implements a more robust sorting algorithm to ensure that if
the migration files use a prefix that is numeric, it will sort in the
expected way.