aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-07-09 16:28:15 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-07-09 16:28:15 +0000
commit32a800761e3e6b126a9892375469bf0c2b455116 (patch)
tree2c61edc5911aeb5404a4d8afc8567859a4c1f1d9 /activerecord/lib
parent47a3bafe26fb5f773ac082162c3e595ce80d9ad7 (diff)
downloadrails-32a800761e3e6b126a9892375469bf0c2b455116.tar.gz
rails-32a800761e3e6b126a9892375469bf0c2b455116.tar.bz2
rails-32a800761e3e6b126a9892375469bf0c2b455116.zip
Made target migrations actually work
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1781 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/migration.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index a71e367ef2..6709439764 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -169,7 +169,7 @@ module ActiveRecord
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 @@ module ActiveRecord
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