Added a more powerful update script.

We are phasing in a new way of writing our SQL scripts. This is the first, pilot phase. The script should be smart enough to not completely fail on error, should return a status code indicating success or fail, and should only upgrade things that have not yet been upgraded. This way, if the update fails, the user can correct the issue and rerun the script without needing to modify it in any way.

This will also be important for continuous-integration systems that will need more fault tolerance when upgrading new systems.

References #535