0

I am trying to add an Hstore "Details" column to my products table, as follows:

# 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

Migration was ran on the above, and then the one below

# 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

I thought it might be necessary to run the enable_extension migration before the column addition migration, but either way it gives the following error in my Schema

# schema.rb
# Could not dump table "products" because of following StandardError
#   Unknown type 'hstore' for column 'details'

The table still works fine in my application though, so is this an error I can just ignore? I don't like not being able to view the table in my Schema.

Tyler P
  • 63
  • 2
  • 7

1 Answers1

1

Lost my schema.rb! Can it be regenerated?

Or to save you time, try from terminal:

rake db:schema:dump
Mark
  • 6,112
  • 4
  • 21
  • 46
  • That didn't work, thanks for the link though! I'm going to have to do some consolidating of my current "test" platform and create some seeds so I can dump the whole DB and try from the beginning. I'll also note that it's only the `Products` table that is throwing this error; none of the others are. – Tyler P Feb 02 '18 at 16:26