Forum: Ruby on Rails Migrations with multi-column indexes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9fc9f31415f9384fbe7262fa916e16f5?d=identicon&s=25 Brian Corrigan (Guest)
on 2006-03-20 22:13
(Received via mailing list)
Hey Folks,

I can't really glean this from the documentation.

Is there a way to do: add_index(table_name, column_name, index_type)
within my migration for an index that spans multiple columns?  Ie: A
covering index on FIRST_NAME, LAST_NAME or something like that?

Best,
Brian


---------------------------
Brian Corrigan
---------------------------
0091f92762685860109bbcb02edfdf27?d=identicon&s=25 Alain Ravet (Guest)
on 2006-03-21 00:27
(Received via mailing list)
Brian

Try

       add_index :people [:id, :first_name, :last_name], :name =>
:people_all, :unique => true

     > Is there a way to do: add_index(table_name, column_name,
index_type)
     > within my migration for an index that spans multiple columns?
Ie: A
     > covering index on FIRST_NAME, LAST_NAME or something like that?

Alain
This topic is locked and can not be replied to.