diff --git a/lib/camping/ar.rb b/lib/camping/ar.rb index 94f02f3..fa6b7ed 100644 --- a/lib/camping/ar.rb +++ b/lib/camping/ar.rb @@ -35,7 +35,7 @@ def self.create_schema(opts = {}) si = SchemaInfo.find(:first) || SchemaInfo.new(:version => opts[:assume]) if si.version < opts[:version] - @migrations.each do |k| + (@migrations.sort do |a,b| a.version <=> b.version end).each do |k| k.migrate(:up) if si.version < k.version and k.version <= opts[:version] k.migrate(:down) if si.version > k.version and k.version > opts[:version] end