build the database