根据 https://postgres.heroku.com/blog/past/2012/4/26/heroku_postgres_development_plan/ 我做了“heroku addons:add heroku-postgresql:dev”。但是当我这样做时

class CreateUsers < ActiveRecord::Migration
  def up
    create_table :users do |t|
      execute "CREATE EXTENSION hstore"
      t.hstore :access
    end
  end

  def down
    drop_table :users
      execute "DROP EXTENSION hstore"
    end
  end
end

然后“heroku run rake db:migrate”我收到这个错误:

PG::Error: 错误:“EXTENSION”处或附近的语法错误
第 1 行:创建扩展 hstore ^
: 创建扩展 hstore

最佳答案

终于让它工作了。原来我需要按照 https://devcenter.heroku.com/articles/heroku-postgres-dev-plan 使用 heroku pg:promote 来“提升”数据库

关于ruby-on-rails-3 - 如何在 Heroku 上使用 hstore,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11202988/

10-16 17:22