Add memory db, add abstract for databases