Skip to content

Commit

Permalink
Merge pull request #2697 from jhawthorn/fix_dropping_db_with_automigr…
Browse files Browse the repository at this point in the history
…ation

Fix error dropping postgres db in automigration
  • Loading branch information
gmacdougall authored Apr 17, 2018
2 parents 0cebb4d + 3cc4095 commit d5a5b48
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/lib/spree/testing_support/dummy_app/migrations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ def needs_migration?
def auto_migrate
if needs_migration?
puts "Configuration changed. Re-running migrations"

# Disconnect to avoid "database is being accessed by other users" on postgres
ActiveRecord::Base.remove_connection

sh 'rake db:reset VERBOSE=false'

# We might have a brand new database, so we must re-establish our connection
# We have a brand new database, so we must re-establish our connection
ActiveRecord::Base.establish_connection
end
end
Expand Down

0 comments on commit d5a5b48

Please sign in to comment.