Migrations bug

David Naseby
Wed, 21 Sep 2005 03:17:45 -0000

Migrations fail on windows for numbers > 10. To fix this, change
migrations.rb #migration_files to:

      def migration_files
        files = Dir["#{@migrations_path}/[0-9]*_*.rb"].sort_by do |f|
          migration_version_and_name(f).first.to_i
        end
        down? ? files.reverse : files
      end

Previously, it was sorting on a string of the file name, meaning that
you''d usually start migrating 10_<migration_file>.rb before
getting to
1_<migration_file>.rb, resulting in 1-9 never being applied. Nasty.

--
David Naseby