在使用Postgres的Rails中,如何在UUID数组上添加索引?

时间:2019-06-06 18:40:38

标签: postgresql ruby-on-rails-5 uuid

我正在尝试使用Postgres 9.6在Rails中的UUID数组上添加索引。这是我的迁移...

class AddProductIdsToApplications < ActiveRecord::Migration[5.2]
  def change
    add_column :applications, :product_ids, :uuid, array: true, default: [] 
    add_index :applications, :product_ids, using: 'gin'
  end
end

我遇到此错误...

>     PG::UndefinedObject: ERROR:  data type uuid[] has no default operator class for access method "gin"
>     HINT:  You must specify an operator class for the index or define a default operator class for the data type.

是否有针对此的迁移修复程序?

0 个答案:

没有答案