# Will it automatically add index to forien\_keys?

**URL:** <https://www.ruby-forum.com/t/will-it-automatically-add-index-to-forien-keys/129189>\
**Category:** Rails\
**Created:** [February 15, 2008, 7:18am UTC](https://www.ruby-forum.com/t/will-it-automatically-add-index-to-forien-keys/129189 "2008-02-15T07:18:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [February 15, 2008, 7:18am UTC](https://www.ruby-forum.com/t/will-it-automatically-add-index-to-forien-keys/129189/1 "2008-02-15T07:18:06Z")

</div>

has\_may ,belongs\_to ,etc  
in those Model association ,will it automatically add index to  
forien\_keys ?

---

<div class="post-metadata">

**Author:** ![mokkai](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@mokkai](https://www.ruby-forum.com/u/mokkai)\
**Post date:** [February 15, 2008, 9:11am UTC](https://www.ruby-forum.com/t/will-it-automatically-add-index-to-forien-keys/129189/2 "2008-02-15T09:11:26Z")

</div>

Pokkai D. wrote:

> has\_may ,belongs\_to ,etc  
> in those Model association ,will it automatically add index to  
> forien\_keys ?

no, you need to use the  
add\_index :table, :column\_name  
in your migrations
