change database logic