aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-02-13 19:07:13 +0100
committerYves Senn <yves.senn@gmail.com>2014-02-13 19:07:13 +0100
commitad482673d7c3c4fa93efe9b6a91c822d8010dfa9 (patch)
treed90da2192c59ac881d08a01692ce7480371e3cc9 /activerecord/lib
parent24fc74c0ed076d670018f1ae3705d495aeddbec2 (diff)
parente1d4673102f7c4e58964a6de864402ae9a615688 (diff)
downloadrails-ad482673d7c3c4fa93efe9b6a91c822d8010dfa9.tar.gz
rails-ad482673d7c3c4fa93efe9b6a91c822d8010dfa9.tar.bz2
rails-ad482673d7c3c4fa93efe9b6a91c822d8010dfa9.zip
Merge pull request #14034 from hdabrows/drop-correct-index-when-reverting-migration
Drop the correct index after reverting a migration
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/migration/command_recorder.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb
index 9139ad953c..c44d8c1665 100644
--- a/activerecord/lib/active_record/migration/command_recorder.rb
+++ b/activerecord/lib/active_record/migration/command_recorder.rb
@@ -140,7 +140,12 @@ module ActiveRecord
def invert_add_index(args)
table, columns, options = *args
- [:remove_index, [table, (options || {}).merge(column: columns)]]
+ options ||= {}
+
+ index_name = options[:name]
+ options_hash = index_name ? { name: index_name } : { column: columns }
+
+ [:remove_index, [table, options_hash]]
end
def invert_remove_index(args)