Put more repeated strings into functions
Add helper for creating index names
Fix update SQL statement
Drop a foreign key and an index before dropping column
Move DB update routine to the end of checksetup