From a7fad65792b37a3f8643149ebbee64cfabfbcea8 Mon Sep 17 00:00:00 2001 From: David Workman Date: Mon, 23 May 2011 13:54:38 +0100 Subject: Simple fix for correctly inverting an add_index migration when a name has been provided --- activerecord/lib/active_record/migration/command_recorder.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/migration/command_recorder.rb b/activerecord/lib/active_record/migration/command_recorder.rb index c9d57ce812..5f4dd798a7 100644 --- a/activerecord/lib/active_record/migration/command_recorder.rb +++ b/activerecord/lib/active_record/migration/command_recorder.rb @@ -79,8 +79,12 @@ module ActiveRecord end def invert_add_index(args) - table, columns, _ = *args - [:remove_index, [table, {:column => columns}]] + table, columns, options = *args + if options && options[:name] + [:remove_index, [table, {:name => options[:name]}]] + else + [:remove_index, [table, {:column => columns}]] + end end def invert_remove_timestamps(args) -- cgit v1.2.3