Extract database connection to DRY up rake tasks