moving the db require to where it is actually needed