better legacy vs. active database handling

this fixes an issue when we have a CLEAR_DB_URL, but no DB_[..] or LEGACY_DB_[..] variables