aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks/extensions.rake
diff options
context:
space:
mode:
authorXinhui2016-10-11 16:00:38 +0200
committerXinhui2016-10-11 16:00:38 +0200
commita0b4862e2307d0b619df254cf07912521355ec7d (patch)
tree61bb675965cccda654a3f6a40b97d6734e004bf1 /lib/tasks/extensions.rake
parent3c585b26cf7705b371f7798061df7c6c225f381f (diff)
downloadchouette-core-a0b4862e2307d0b619df254cf07912521355ec7d.tar.bz2
Attempt to enable hstore using migration
Ref #1789
Diffstat (limited to 'lib/tasks/extensions.rake')
-rw-r--r--lib/tasks/extensions.rake15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/tasks/extensions.rake b/lib/tasks/extensions.rake
new file mode 100644
index 000000000..6ede62b10
--- /dev/null
+++ b/lib/tasks/extensions.rake
@@ -0,0 +1,15 @@
+namespace :db do
+ desc 'Creates shared_extensions Schema and enables hstore extension'
+ task :extensions => :environment do
+ ActiveRecord::Base.connection.execute 'CREATE SCHEMA IF NOT EXISTS shared_extensions;'
+ ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS hstore SCHEMA shared_extensions;'
+ end
+end
+
+Rake::Task["db:create"].enhance do
+ Rake::Task["db:extensions"].invoke
+end
+
+Rake::Task["db:test:purge"].enhance do
+ Rake::Task["db:extensions"].invoke
+end