aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks/extensions.rake
blob: 6ede62b1093b47edf46d3f3428cafa21ea9bbb12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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