Hi there

Renaming rails database index names via migration

Apparently you can't use the same syntax as the create index, just using the column name, but rather, you need to use the full name of the index created, which can be found in your database structure file or the schema description of the table who's index you want to alter


Instead of;
rename_index :table_name, :old_index_column_name, :new_index_column_name
You need;
rename_index :table_name, 'index_table_name_on_old_column_name', 'index_table_name_on_new_column_name' (or however they are named in your structure)

I found incorrect answers in all of the StackOverflow posts, which is unusual, but, as should be expected, the correct answer was found in the API docs => http://apidock.com/rails/v3.2.13/ActiveRecord/ConnectionAdapters/SchemaStatements/rename_index