Handle database upgrade for MSIM

Change-Id: I7c37252900bf0a61fdd64b301ab5b852711a42e5
Missing commas before sub_id in sql queries

Change-Id: I74abc23535f6a008c91b15343e9558711a515c44
Properly handle alphanumeric 'numbers'.

Change-Id: I326198c19bb567846d09f8bb8c293a024c830296
JIRA:CYAN-3234