Add forwards when upgrades register and unregister

SMRPG_OnUpgradeRegistered and SMRPG_OnUpgradeUnregistered are fired to
track which upgrades are loaded.
Minor change to queries to help with type affinity

If the field is an INTEGER, don't pass values as strings.