What if update.php fails due to code errors? I sometimes run into the issue, when my PHP code has errors. I run update.php, but it fails with a php error message. After that, Drupal seems to think that the database is up-to-date, but it isn't. Trouble is, running update.php again does not solve the problem.

For example, just now, it has failed to create the tables for a newly created entity. update.php does nothing, but all my Entity code – of course – fails with database errors.

I don't know how to recover from this situation, other than uninstalling and reinstalling the module, which means killing all content first.
You could also rerun the update after you fixed your code.

See here:
reseting the hook_update_n status of a module