Does drop_table also remove_index?

Well, the title pretty much says it all, but here it is again: will drop_table also remove any indexes for that table? Or do we need to specify each index in the down migration?

I tried looking through the drop_table documentation, but didn't see it mentioned. I also checked some of the more popular open source projects, and they just drop_table, but don't remove any indexes. Maybe rails takes care of this as part of its "magic" ?

The database itself probably deletes indices for tables that no longer exist. You should check your database's documentation to be sure.

~David

That is a database function. Dropping a table will also drop the indexes (at least for MySQL and SQL Server).

Foreign key constraints are another issue. If you have added them (i.e. via foreign_key_migrations), you would have to explicitly remove them in your down migration before dropping the parent table.