aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/Rakefile
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-05-23 03:37:02 +0900
committerkennyj <kennyj@gmail.com>2012-06-12 19:34:24 +0900
commit34492af710e9309f58eb740029f5076d0f59ea18 (patch)
treefc551a8889b51f06d7268116e6746c721d403753 /activerecord/Rakefile
parent122f6de2e038dbbece4ee59ddcfcf75ae9c49f63 (diff)
downloadrails-34492af710e9309f58eb740029f5076d0f59ea18.tar.gz
rails-34492af710e9309f58eb740029f5076d0f59ea18.tar.bz2
rails-34492af710e9309f58eb740029f5076d0f59ea18.zip
Create hstore extension when building PostgreSQL databases.
Diffstat (limited to 'activerecord/Rakefile')
-rw-r--r--activerecord/Rakefile10
1 files changed, 10 insertions, 0 deletions
diff --git a/activerecord/Rakefile b/activerecord/Rakefile
index 7feb0b75a0..a29d7b0e99 100644
--- a/activerecord/Rakefile
+++ b/activerecord/Rakefile
@@ -114,6 +114,16 @@ namespace :postgresql do
config = ARTest.config['connections']['postgresql']
%x( createdb -E UTF8 #{config['arunit']['database']} )
%x( createdb -E UTF8 #{config['arunit2']['database']} )
+
+ # prepare hstore
+ version = %x( createdb --version ).strip.gsub(/(.*)(\d\.\d\.\d)$/, "\\2")
+ %w(arunit arunit2).each do |db|
+ if version < "9.1.0"
+ puts "Please prepare hstore data type. See http://www.postgresql.org/docs/9.0/static/hstore.html"
+ else
+ %x( psql #{config[db]['database']} -c "CREATE EXTENSION hstore;" )
+ end
+ end
end
desc 'Drop the PostgreSQL test databases'