aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/migration.rb10
1 files changed, 7 insertions, 3 deletions
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