Skip to content
This repository
Browse code

Create hstore extension when building PostgreSQL databases.

  • Loading branch information...
commit 34492af710e9309f58eb740029f5076d0f59ea18 1 parent 122f6de
Toshinori Kajihara kennyj authored
10 activerecord/Rakefile
@@ -114,6 +114,16 @@ namespace :postgresql do
114 114 config = ARTest.config['connections']['postgresql']
115 115 %x( createdb -E UTF8 #{config['arunit']['database']} )
116 116 %x( createdb -E UTF8 #{config['arunit2']['database']} )
  117 +
  118 + # prepare hstore
  119 + version = %x( createdb --version ).strip.gsub(/(.*)(\d\.\d\.\d)$/, "\\2")
  120 + %w(arunit arunit2).each do |db|
  121 + if version < "9.1.0"
  122 + puts "Please prepare hstore data type. See http://www.postgresql.org/docs/9.0/static/hstore.html"
  123 + else
  124 + %x( psql #{config[db]['database']} -c "CREATE EXTENSION hstore;" )
  125 + end
  126 + end
117 127 end
118 128
119 129 desc 'Drop the PostgreSQL test databases'
2  guides/source/contributing_to_ruby_on_rails.textile
Source Rendered
@@ -190,6 +190,8 @@ $ rake postgresql:build_databases
190 190
191 191 NOTE: Using the rake task to create the test databases ensures they have the correct character set and collation.
192 192
  193 +NOTE: You'll see the following warning (or localized warning) during activating HStore extension in PostgreSQL 9.1.x or earlier: "WARNING: => is deprecated as an operator".
  194 +
193 195 If you’re using another database, check the files under +activerecord/test/connections+ for default connection information. You can edit these files to provide different credentials on your machine if you must, but obviously you should not push any such changes back to Rails.
194 196
195 197 You can now run the tests as you did for +sqlite3+. The tasks are respectively

0 comments on commit 34492af

Please sign in to comment.
Something went wrong with that request. Please try again.