robmorgan/phinx — pull request #196 by archer308 (2014-03-09 09:22:50+00:00)
Title: Add support for naming indexes

Adds support for specifying a name on an index such as...
```
$table->addIndex(array('username', 'email'), array('unique' => true, 'name' => 'myindexname'));
```
Indexes can also be removed by specifying the name with...
```
$table->removeIndexByName('myindexname');
```

Table::removeIndex( ) makes a call to the underlying adapter's dropIndex( ) method. MysqlAdapter, SQLiteAdapter, and PostgresAdapter all assume that a single string passed to dropIndex( ) for $columns identifies a column name and wrap this string in an array. In effect, Table::removeIndex( ) assumes that a single string passed for $columns is the name of a column from which we wish to drop an index.

This behavior could be changed, and Table::removeIndex( ) could assume that a single string is the name of an index to be removed.

I can imagine this breaking migrations, so instead I opted to create removeIndexByName( ) and dropIndexByName( ).

Thanks!