根据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 : ERROR:在" EXTENSION“行或其附近出现语法错误第1行: CREATE EXTENSION hstore ^:CREATE EXTENSION hstore
发布于 2012-06-27 13:09:12
终于让它起作用了。原来我需要使用heroku pg:promote as per https://devcenter.heroku.com/articles/heroku-postgres-dev-plan来“提升”数据库
发布于 2012-06-27 03:34:47
我认为你想把你的迁移分开,一个去添加hstore,另一个去使用它;
class SetupHStore < ActiveRecord::Migration
def self.up
execute "CREATE EXTENSION hstore"
end
def self.down
execute "DROP EXTENSION hstore"
end
end要启用扩展,您的用户迁移将只添加任何字段,然后在您想要的列上使用hstore。
https://stackoverflow.com/questions/11202988
复制相似问题