From f4d174b211effd4cd510c1578bdc391852f4d375 Mon Sep 17 00:00:00 2001 From: Neeraj Singh Date: Tue, 20 Apr 2010 11:14:00 -0400 Subject: making rake:migrate VERSION=0 a noop called in succession. [#2137 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activerecord/lib/active_record/migration.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index c163fb982a..940f825038 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -384,9 +384,13 @@ module ActiveRecord class << self def migrate(migrations_path, target_version = nil) case - when target_version.nil? then up(migrations_path, target_version) - when current_version > target_version then down(migrations_path, target_version) - else up(migrations_path, target_version) + when target_version.nil? + up(migrations_path, target_version) + when current_version == 0 && target_version == 0 + when current_version > target_version + down(migrations_path, target_version) + else + up(migrations_path, target_version) end end -- cgit v1.2.3