Comments (8)
I have upgraded postgres.app and still no joy. db:structure:dump does not create an entry for the hstore
from activerecord-postgres-hstore.
Could this be because the table and the extension were created inside of a schema?
from activerecord-postgres-hstore.
could you post the exact error message?
from activerecord-postgres-hstore.
Having the same issue here. It seems that something about db:test:prepare is overwriting the availability of the extension.
If I go into my test db and run:
CREATE EXTENSION hstore;
I can see it was created properly by running SELECT * FROM pg_available_extensions;
But if I rerun rake db:test:prepare, it blows up with a type "hstore" does not exist error.
Then if I go back into the test db, the extension is no longer active.
from activerecord-postgres-hstore.
Followup: for me, I think this is an issue with pg_dump not including extensions in the structure.sql. So when it loads that in for tests, the extension isn't there.
Since I'm using the activerecord-postgis-adapter which overrides the db:structure:dump task, I'm going to follow up there and see if there's something going on.
from activerecord-postgres-hstore.
Hi Everybody.
In my case this was because I had created the extension in a different schema. I changed my migration to read like this.
class SetupHstore < ActiveRecord::Migration
@current_search_path = Rails.configuration.database_configuration[Rails.env]['schema_search_path']
def self.up
execute " set search_path = public; CREATE EXTENSION IF NOT EXISTS hstore; set search_path= #{@current_search_path}"
end
def self.down
execute "set search_path = public;DROP EXTENSION IF EXISTS hstore;set search_path= #{@current_search_path}"
end
end
This seems to solve the problem for me.
from activerecord-postgres-hstore.
@diogob You may want to make sure the generator switches to the public schema before it creates the extension by default.
BTW the code I posted fails if there is no search path defined so it has to be made a little more robust.
from activerecord-postgres-hstore.
Thanks for the heads up, I'll use the SCHEMA clause in the CREATE EXTENSION.
from activerecord-postgres-hstore.
Related Issues (20)
- Does hstore support array? HOT 1
- NoMethodError: undefined method `scan' for {}:Hash HOT 9
- undefined method `scan' for {}:Hash HOT 3
- [Question] Schema for extension. HOT 1
- Error when doing migration on new deploy (Schema dump style not set to sql) HOT 2
- interpolating values
- How to read an hstore as a hash (instead of a string)? HOT 2
- hstore indexes not saved to schema.rb correctly. HOT 5
- Hstore return hstore column as a string when used inside a select + join
- Always UPDATE db even if no changes
- Deserialization issue HOT 1
- Rails 4.2 Error: undefined method `simplified_type' HOT 12
- flat-Ruby usage example request (No-Rails!) HOT 1
- undefined method `scan' for #<Hash:0x007fa6f04d66f8> HOT 1
- Version 0.7.8 HOT 2
- NameError after add a gem
- undefined method simplified_type for class ActiveRecord::ConnectionAdapters::PostgreSQLColumn HOT 5
- hstore:step error with rails 5.0.0.1 HOT 1
- Does it work via Rails 5? HOT 1
- add_hstore_index options not working properly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from activerecord-postgres-hstore.