Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

rake db:test:prepare errors #110

Closed
yossi-shasho opened this Issue Aug 4, 2013 · 4 comments

Comments

Projects
None yet
4 participants

When running rake db:test:prepare, it complains it cannot find the hstore extensions.
It fails even if I manually add the extension using plain SQL, because rake db:test:prepare first drops the database, along with the extension i added manually.

The manual solution i found is to write

execute "CREATE EXTENSION IF NOT EXISTS hstore"

in the beginning of schema.rb, but this is bad because this file is auto generated.

The known workaround for it is using the sql format for schema dump, as shown here: https://github.com/diogob/activerecord-postgres-hstore#test-database

But would you mind to try this out?

# lib/tasks/hstore_patch.rake
namespace :hstore do
  task 'setup' do
    ActiveRecord::Base.connection.execute "CREATE EXTENSION IF NOT EXISTS hstore"
  end
end
Rake::Task["db:schema:load"].enhance(["hstore:setup"])

@gregoriokusowski I confirm this solution works, should be included by default.

It does work. +1 for including this by default, since without it this fantastic gem is buggy in a pretty straight-forward scenario.

biggihs commented Oct 22, 2013

+1. Worked.
ruby 2.0.0
rails 3.2.13
pg 9.1

@diogob diogob closed this in a231a2b Nov 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment