# How are indexes managed in migrations

**URL:** <https://www.ruby-forum.com/t/how-are-indexes-managed-in-migrations/140815>\
**Category:** Rails\
**Created:** [June 18, 2008, 9:24pm UTC](https://www.ruby-forum.com/t/how-are-indexes-managed-in-migrations/140815 "2008-06-18T21:24:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [June 18, 2008, 9:24pm UTC](https://www.ruby-forum.com/t/how-are-indexes-managed-in-migrations/140815/1 "2008-06-18T21:24:41Z")

</div>

This is something I have not fully understood. So I figured I would ask  
a quick question.

If I have an index on a column in a table and I rename that column does  
the index reflect the new name? Also what if I remove a column? Is the  
index removed?

Sorry for such a noob question, figured it was easier to ask on here.

---

<div class="post-metadata">

**Author:** ![benjohnson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/3ec8ea/32.png) [@benjohnson](https://www.ruby-forum.com/u/benjohnson)\
**Post date:** [June 18, 2008, 9:34pm UTC](https://www.ruby-forum.com/t/how-are-indexes-managed-in-migrations/140815/2 "2008-06-18T21:34:56Z")

</div>

On Jun 18, 2008, at 3:24 PM, Ben J. wrote:

> This is something I have not fully understood. So I figured I would  
> ask  
> a quick question.
> 
> If I have an index on a column in a table and I rename that column  
> does  
> the index reflect the new name? Also what if I remove a column? Is the  
> index removed?
> 
> Sorry for such a noob question, figured it was easier to ask on here.

This is really a question about your database and its behavior, but I  
suspect that both things are true. Changing a column name means that  
the index still refers to that column with its new name (but the name  
of the index itself which may have been based on the original column  
name has almost certainly not changed) and removing a column causes  
any and all indexes that include that column are similarly removed.  
In all cases, the best way to get the answer is to actually try it and  
see what happens.

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid
