Merge pull request #10702 from divineforest/use-total-in-batches-test

Use @total variable created in the setup of batches tests instead of counting again.
the rake task `db:test:prepare` needs to load the configuration

Without loading the configuration the task will not perform any work.
Merge pull request #10711 from senny/10660_rake_db_test_prepare_needs_config

the rake task `db:test:prepare` needs to load the configuration
Support nested query parameter in DATABASE_URL. Fix #9896.