aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/migration.rb
diff options
context:
space:
mode:
authorschneems <richard.schneeman@gmail.com>2017-01-06 13:30:42 -0600
committerschneems <richard.schneeman@gmail.com>2017-01-06 13:30:42 -0600
commit93ee268ef40b052497daf22f124fc1535acabd64 (patch)
treeb76ce1819cf2bedfdd3e10f73d0a23837d708f23 /activerecord/lib/active_record/migration.rb
parent98c6e4e56ca2a8f9f987e12815f7cdf66e5f1485 (diff)
downloadrails-93ee268ef40b052497daf22f124fc1535acabd64.tar.gz
rails-93ee268ef40b052497daf22f124fc1535acabd64.tar.bz2
rails-93ee268ef40b052497daf22f124fc1535acabd64.zip
Preserve `up` and `down` return type
In Rails 4.2 calling `ActiveRecord::Migrator.migrate` would return an array of results. Without realizing that this return type was expected I accidentally introduced a change in https://github.com/rails/rails/commit/4d60e93174a3d6d90b1a06fc7515cb5cd749a6f3 This PR preserves the previous behavior and adds a test on the return type. This will need a backport to 5.0 branch.
Diffstat (limited to 'activerecord/lib/active_record/migration.rb')
-rw-r--r--activerecord/lib/active_record/migration.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb
index ed0c81b639..6e5f5fa2a7 100644
--- a/activerecord/lib/active_record/migration.rb
+++ b/activerecord/lib/active_record/migration.rb
@@ -1170,9 +1170,10 @@ module ActiveRecord
def run_without_lock
migration = migrations.detect { |m| m.version == @target_version }
raise UnknownMigrationVersionError.new(@target_version) if migration.nil?
- execute_migration_in_transaction(migration, @direction)
+ result = execute_migration_in_transaction(migration, @direction)
record_environment
+ result
end
# Used for running multiple migrations up to or down to a certain value.
@@ -1181,11 +1182,12 @@ module ActiveRecord
raise UnknownMigrationVersionError.new(@target_version)
end
- runnable.each do |migration|
+ result = runnable.each do |migration|
execute_migration_in_transaction(migration, @direction)
end
record_environment
+ result
end
# Stores the current environment in the database.