@@ -224,7 +224,8 @@ defmodule Ecto.Migration.Runner do
224224 do: { :create , index }
225225 defp reverse ( { :drop_if_exists , % Index { } = index , _ } ) ,
226226 do: { :create_if_not_exists , index }
227-
227+ defp reverse ( { :rename , % Index { } = index , new_name } ) ,
228+ do: { :rename , % { index | name: new_name } , index . name }
228229 defp reverse ( { :create , % Table { } = table , _columns } ) ,
229230 do: { :drop , table , :restrict }
230231 defp reverse ( { :create_if_not_exists , % Table { } = table , _columns } ) ,
@@ -418,6 +419,8 @@ defmodule Ecto.Migration.Runner do
418419 do: "drop index #{ quote_name ( index . prefix , index . name ) } #{ drop_mode ( mode ) } "
419420 defp command ( { :drop_if_exists , % Index { } = index , mode } ) ,
420421 do: "drop index if exists #{ quote_name ( index . prefix , index . name ) } #{ drop_mode ( mode ) } "
422+ defp command ( { :rename , % Index { } = index_current , new_name } ) ,
423+ do: "rename index #{ quote_name ( index_current . name ) } to #{ new_name } "
421424 defp command ( { :rename , % Table { } = current_table , % Table { } = new_table } ) ,
422425 do: "rename table #{ quote_name ( current_table . prefix , current_table . name ) } to #{ quote_name ( new_table . prefix , new_table . name ) } "
423426 defp command ( { :rename , % Table { } = table , current_column , new_column } ) ,
0 commit comments