具体来说,我想添加一个 spatial 索引 multi_polygon 柱子。这很好地工作 Postgresql 但不在 mysql, ,所以我在想像:

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

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

有可能还是个好主意?

有帮助吗?

解决方案

您可以通过这种方式通过索引

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

这将在MySQL,PostgreSQL,Oracle和DB2上使用。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top