From b77d2aa0c336492ba33cbfade4964ba0eda3ef84 Mon Sep 17 00:00:00 2001 From: bogdanvlviv Date: Sat, 25 Feb 2017 17:49:32 +0200 Subject: Fix `bin/rails db:forward` first migration --- activerecord/lib/active_record/migration.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') 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] -- cgit v1.2.3