我有一个迁移,我会像这样创建一个产品表。
在activerecord-postgres-hstore页面上,他们使用SQL向表中添加索引。
class CreateProducts < ActiveRecord::Migration
def change
create_table :products do |t|
t.string :name
t.hstore :data
t.timestamps
end
end
end
在activerecord-postgres-hstore页面上,他们使用SQL向表中添加索引。
CREATE INDEX products_gin_data ON products USING GIN(data);
然而,这种更改不会被迁移所跟踪(我猜测是因为它是特定于Postgres的?),有没有一种方法可以在迁移中创建索引?
谢谢!