问题
I have a table in a Mysql db that I want to use multicolumn indexing on. How can I do this in rails w/o using the mysql console?
回答1:
Inside a migration definition you can do it like this:
add_index :table_name, [:column1, :column2]
来源:https://stackoverflow.com/questions/3825762/index-multiple-columns-w-ruby-on-rails