Index Multiple Columns w/ Ruby on Rails

谁都会走 提交于 2020-01-04 06:56:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!