Remove pg and sqlite3 gems, move to app-managed database connections

Profiling shows that most time is being spent in AR connection management.