Created
June 20, 2017 08:24
-
-
Save almaron/31cd181e6fb1c03ddb15633a80a05543 to your computer and use it in GitHub Desktop.
This file contains 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
# frozen_string_literal: true | |
namespace :db do | |
desc 'Also create shared_extensions Schema' | |
task extensions: :environment do | |
# Create Schema | |
ActiveRecord::Base.connection.execute 'CREATE SCHEMA IF NOT EXISTS shared_extensions;' | |
# Enable Hstore | |
ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS HSTORE SCHEMA shared_extensions;' | |
# Enable UUID-OSSP | |
ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp" 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment