我正在尝试将Hstore“Details”列添加到product表中,如下所示:
# 20180202133309_add_hstore_extension.rb
class AddHstoreExtension < ActiveRecord::Migration[5.1]
def self.up
enable_extension "hstore"
end
def self.down
disable_extension "hstore"
end
end
上面运行了迁移,然后是
下面的迁移# 20180202133435_add_hstore_to_products.rb
class AddHstoreToProducts < ActiveRecord::Migration[5.1]
def change
add_column :products, :details, :hstore
add_index :products, :details, using: :gin
end
end
我认为可能有必要在列添加迁移之前运行enable_extension
迁移,但无论哪种方式,它都会在我的架构中出现以下错误
# schema.rb
# Could not dump table "products" because of following StandardError
# Unknown type 'hstore' for column 'details'
该表在我的应用程序中仍然可以正常工作,所以这是一个我可以忽略的错误吗?我不喜欢无法在我的架构中查看该表。