! Lots of SQLite3 fixes

This commit mostly makes changes to support upgrading on SQLite3, but also includes a few other minor SQLite3-related fixes.

I am not entirely sure everything is fixed, as it seems to not want to add columns to tables via $smcFunc['db_add_column'] / $smcFunc['db_alter_table'] on my setup, but I wanted to commit this to see if it was a problem on my end or a problem with SQLite3 in general.

Signed-off-by: Michael Eshom <oldiesmann@oldiesmann.us>