【发布时间】:2017-09-02 20:12:57
【问题描述】:
我明白了:
PG::UndefinedObject: ERROR: type "hstore" does not exist
LINE 1: ...arying(255), "finish" timestamp, "widget_locations" hstore)
下面是我的 Travis 配置文件:
language: ruby
rvm:
- 2.0.0
env:
- DB=postgresql
script:
- RAILS_ENV=test bundle exec rake db:migrate --trace
- bundle exec rake db:test:prepare
- bundle exec rspec spec/
before_script:
- cp config/database.travis.yml config/database.yml
- psql -c 'create database virtual_test' -U postgres
- psql virtual_test -c 'CREATE EXTENSION hstore' -U postgres
bundler_args: --binstubs=./bundler_stubs
before_install:
- bundle update debugger-ruby_core_source
我还有以下迁移文件:
class SetupHstore < ActiveRecord::Migration
def self.up
execute 'CREATE EXTENSION IF NOT EXISTS hstore'
end
def self.down
execute 'DROP EXTENSION IF EXISTS hstore'
end
end
无论如何,这都会产生错误。
这里有什么问题吗?
【问题讨论】:
-
请尝试从
psql控制台启用hstore:CREATE EXTENSION hstore -
我已经有
before_script命令` - psql virtual_test -c 'CREATE EXTENSION hstore' -U postgres` 可以吗?
标签: ruby-on-rails ruby postgresql ruby-on-rails-4 travis-ci