Sha256: 4eedb5b099adf9ed7364267ca4b2ac3cb70d08ad7012415b2c444534ab3af343

Contents?: true

Size: 1.08 KB

Versions: 29

Compression:

Stored size: 1.08 KB

Contents

# Rake tasks for Core DB
#
# include in Rakefile via:
#
# require 'vault-tools/core_db_tasks'

desc "Pull db/structure.sql from api HEAD"
task :pull_core_schema do
  steps = []
  steps << 'mkdir -p contrib/'
  steps << 'cd contrib/'
  if File.exists?('contrib/core')
    steps << 'rm -rf core'
  end
  steps << 'git clone -n git@github.com:heroku/api core --depth 1'
  steps << 'cd core'
  steps << 'git checkout HEAD db/structure.sql'
  steps << 'git checkout HEAD db/analytics_grants.sql'
  # make sure we don't submodule it
  steps << 'rm -rf .git'
  sh steps.join(' && ')
end

desc "Drop and recreate the core-test database"
task :create_core_db => [:drop_core_db] do
  sh 'createdb core-test'
  sh 'psql --no-psqlrc core-test -c "DROP ROLE IF EXISTS analytics;"'
  sh 'psql --no-psqlrc core-test -c "CREATE ROLE analytics ENCRYPTED PASSWORD \'password\' LOGIN;"'
  sh 'psql --no-psqlrc core-test -f contrib/core/db/structure.sql'
  sh 'psql --no-psqlrc core-test -f contrib/core/db/analytics_grants.sql'
end

desc "Drop the core-test database"
task :drop_core_db do
  sh 'dropdb core-test || true'
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
vault-tools-2.1.1 lib/vault-tools/core_db_tasks.rb
vault-tools-2.1.0 lib/vault-tools/core_db_tasks.rb
vault-tools-2.0.2 lib/vault-tools/core_db_tasks.rb
vault-tools-2.0.1 lib/vault-tools/core_db_tasks.rb
vault-tools-2.0.0 lib/vault-tools/core_db_tasks.rb
vault-tools-1.0.1 lib/vault-tools/core_db_tasks.rb
vault-tools-1.0.0 lib/vault-tools/core_db_tasks.rb
vault-tools-0.7.1 lib/vault-tools/core_db_tasks.rb
vault-tools-0.7.0 lib/vault-tools/core_db_tasks.rb
vault-tools-0.6.5 lib/vault-tools/core_db_tasks.rb
vault-tools-0.6.4 lib/vault-tools/core_db_tasks.rb
vault-tools-0.6.3 lib/vault-tools/core_db_tasks.rb
vault-tools-0.6.2 lib/vault-tools/core_db_tasks.rb
vault-tools-0.6.1 lib/vault-tools/core_db_tasks.rb
vault-tools-0.6.0 lib/vault-tools/core_db_tasks.rb
vault-tools-0.5.22 lib/vault-tools/core_db_tasks.rb
vault-tools-0.5.21 lib/vault-tools/core_db_tasks.rb
vault-tools-0.5.19 lib/vault-tools/core_db_tasks.rb
vault-tools-0.5.18 lib/vault-tools/core_db_tasks.rb
vault-tools-0.5.17 lib/vault-tools/core_db_tasks.rb