Created
August 6, 2014 14:23
-
-
Save kucaahbe/e807eb568e308886cb59 to your computer and use it in GitHub Desktop.
enable hstore in postgres (requires user to be superuser)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EnableHstore < ActiveRecord::Migration | |
def up | |
enable_extension :hstore | |
rescue ActiveRecord::StatementInvalid => maybe_hstore_exception | |
if maybe_hstore_exception.original_exception.is_a? PG::UndefinedFile | |
STDERR.puts <<MSG | |
***************************************************** | |
Exception occured during enabling "hstore" extension. | |
If you your OS is debian/ubuntu then try to install "postgresql-contrib" package. | |
***************************************************** | |
MSG | |
end | |
raise maybe_hstore_exception | |
end | |
def down | |
disable_extension :hstore | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment