Skip to content

Commit

Permalink
Merge pull request #9813 from dmarcoux/simplify-rake-db-calls
Browse files Browse the repository at this point in the history
Simplify rake db:* calls
  • Loading branch information
hennevogel committed Jun 23, 2020
2 parents d472654 + 57f24ec commit fe1c57b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Expand Up @@ -40,7 +40,7 @@ aliases:

- &create_test_db
name: Create database
command: cd src/api; bundle exec rake db:create db:structure:load db:seed RAILS_ENV=test
command: cd src/api; bundle exec rake db:setup RAILS_ENV=test

- &bootstrap_old_test_suite
name: Setup application
Expand Down
2 changes: 1 addition & 1 deletion dist/obs-api-testsuite-rspec.spec
Expand Up @@ -57,7 +57,7 @@ bundle --local --path %_libdir/obs-api/
./script/prepare_spec_tests.sh

export RAILS_ENV=test
bin/rake db:create db:structure:load db:seed
bin/rake db:setup
bin/rails assets:precompile

bin/rspec -f d --exclude-pattern 'spec/db/**/*_spec.rb'
Expand Down
2 changes: 1 addition & 1 deletion dist/setup-appliance.sh
Expand Up @@ -277,7 +277,7 @@ function prepare_database_setup {
if [ -n "$RUN_INITIAL_SETUP" ]; then
logline "Initialize OBS api database (first time only)"
cd $apidir
RAKE_COMMANDS="db:create db:structure:load db:seed writeconfiguration"
RAKE_COMMANDS="db:setup writeconfiguration"
else
logline "Migrate OBS api database"
cd $apidir
Expand Down
9 changes: 2 additions & 7 deletions src/api/lib/tasks/dev.rake
Expand Up @@ -32,9 +32,7 @@ namespace :dev do
begin
Rake::Task['db:version'].invoke
rescue
Rake::Task['db:create'].invoke
Rake::Task['db:structure:load'].invoke
Rake::Task['db:seed'].invoke
Rake::Task['db:setup'].invoke
if args.old_test_suite
puts 'Old test suite. Loading fixtures...'
Rake::Task['db:fixtures:load'].invoke
Expand Down Expand Up @@ -256,10 +254,7 @@ namespace :dev do
include ActiveSupport::Testing::TimeHelpers

Rails.cache.clear
Rake::Task['db:drop'].invoke
Rake::Task['db:create'].invoke
Rake::Task['db:structure:load'].invoke
Rake::Task['db:seed'].invoke
Rake::Task['db:reset'].invoke

# enable responsive_ux as default
Flipper[:responsive_ux].enable
Expand Down
2 changes: 1 addition & 1 deletion src/api/script/api_minitest.sh
Expand Up @@ -14,7 +14,7 @@ bin/rake db:migrate:with_data db:structure:dump db:drop

# entire test suite
export RAILS_ENV=test
bin/rake db:create db:structure:load db:seed
bin/rake db:setup

bin/rails assets:precompile

Expand Down

0 comments on commit fe1c57b

Please sign in to comment.