Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 我可以根据数据库适配器更改迁移吗?它将如何反映在schema.rb中?_Ruby On Rails_Database Migration - Fatal编程技术网

Ruby on rails 我可以根据数据库适配器更改迁移吗?它将如何反映在schema.rb中?

Ruby on rails 我可以根据数据库适配器更改迁移吗?它将如何反映在schema.rb中?,ruby-on-rails,database-migration,Ruby On Rails,Database Migration,具体来说,我想在多多边形列中添加一个空间索引。这在PostgreSQL中很好地工作,但在MySQL中不起作用,因此我想到了一些类似的东西: create_table :figures do |t| t.multi_polygon :polygon end add_index :figures, :polygon if database_adapter == :postgresql 这可能是个好主意吗?您可以通过这种方式传递索引 添加索引(:figures,[:polygon,:extra

具体来说,我想在
多多边形
列中添加一个
空间
索引。这在PostgreSQL中很好地工作,但在MySQL中不起作用,因此我想到了一些类似的东西:

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

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

这可能是个好主意吗?

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

添加索引(:figures,[:polygon,:extra1,:extra2],:name=>“fig\u poly”)


这将适用于mysql、postgresql、oracle和db2。

什么是:extra1和:extra2?其他专栏?