buzzn / core

Die Kraft der Gemeinschaft
GNU Affero General Public License v3.0
1 stars 0 forks source link

Add pgreset, further cleanups and documentation #1426

Closed phillipoertel closed 6 years ago

phillipoertel commented 6 years ago

The pgreset gem takes care of closing all db connections everywhere when rake db:reset is run. So all rake tasks that need to do that now run reliably. That used to cause a lot of pain for me during the import. I now changed many locations to use rake db:reset.

This PR also has several other documentation and rake task updates & cleanups, best to look at the commits one by one.

phillipoertel commented 6 years ago

I'm surprised as well that the test runtime is doubled; there shouldn't be any effect on that by the gem alone. Maybe some other change caused that. I'll investigate ...

All the gem does is extend 'rake db:reset' to close all PG connections before dropping the DB. This fixes the following problem I usually get several times a day:

$ rake db:reset db:seed:example_data db:seed:buzzn_operator beekeeper:import
PG::ObjectInUse: ERROR:  database "buzzn_development" is being accessed by other users
DETAIL:  There is 1 other session using the database.
: DROP DATABASE IF EXISTS "buzzn_development"
mkristian commented 6 years ago

@phillipoertel looking at the timings again. it is all possible branches that things look slower. so if you can double check that this gem is just patching the one rake tasks, then I am OK with this PR