views:

18

answers:

1

Specifically, I want to add an spatial index in a multi_polygon column. This works nicely in PostgreSQL but not in MySQL, so I was thinking of somthing like:

create_table :figures do |t|
  t.multi_polygon :polygon
end

add_index :figures, :polygon if database_adapter == :postgresql

Is it possible and a good idea?

A: 

You can pass index this way

add_index(:figures, [:polygon,:extra1,:extra2], :name => 'fig_poly')

This will work on mysql,postgresql,oracle and db2.

krunal shah
What are :extra1 and :extra2? Another columns?
Erik Escobedo
@Erik Yes. Another columns.
krunal shah