aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorbogdanvlviv <bogdanvlviv@gmail.com>2017-02-25 17:49:32 +0200
committerbogdanvlviv <bogdanvlviv@gmail.com>2017-04-19 21:32:26 +0300
commitb77d2aa0c336492ba33cbfade4964ba0eda3ef84 (patch)
treedcd6c9d3248d462b4d28a55115c3b0a35edb34e9 /activerecord/lib/active_record
parentc324f5d8bbd717b308776bf47a5fed83ce691e66 (diff)
downloadrails-b77d2aa0c336492ba33cbfade4964ba0eda3ef84.tar.gz
rails-b77d2aa0c336492ba33cbfade4964ba0eda3ef84.tar.bz2
rails-b77d2aa0c336492ba33cbfade4964ba0eda3ef84.zip
Fix `bin/rails db:forward` first migration
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/migration.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index 4e1df1432c..43b6a746e0 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -1104,7 +1104,13 @@ module ActiveRecord
def move(direction, migrations_paths, steps)
migrator = new(direction, migrations(migrations_paths))
- start_index = migrator.migrations.index(migrator.current_migration)
+
+ start_index =
+ if current_version == 0
+ 0
+ else
+ migrator.migrations.index(migrator.current_migration)
+ end
if start_index
finish = migrator.migrations[start_index + steps]