Revert "Missing commas before sub_id in sql queries"

This reverts commit 3382aac641e8cce3df165d5022f0a018b491a428.
Revert "Handle database upgrade for MSIM"

This reverts commit cbe1787e7acc45854344cf2b0473889c22ca0c0b.