Permalink
Browse files

Made target migrations actually work

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1781 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 47a3baf commit 32a800761e3e6b126a9892375469bf0c2b455116 @dhh dhh committed Jul 9, 2005
Showing with 5 additions and 3 deletions.
  1. +5 −3 activerecord/lib/active_record/migration.rb
@@ -169,7 +169,7 @@ def current_version
end
def migrate
- migration_classes do |version, migration_class|
+ migration_classes.each do |(version, migration_class)|
Base.logger.info("Reached target version: #{@target_version}") and break if reached_target_version?(version)
next if irrelevant_migration?(version)
@@ -181,11 +181,13 @@ def migrate
private
def migration_classes
- for migration_file in migration_files
+ migrations = migration_files.collect do |migration_file|
load(migration_file)
version, name = migration_version_and_name(migration_file)
- yield version, migration_class(name)
+ [ version.to_i, migration_class(name) ]
end
+
+ down? ? migrations.sort.reverse : migrations.sort
end
def migration_files

0 comments on commit 32a8007

Please sign in to comment.