Allow templates for appconfigitems, installers and upgraders of type sqlscript
Bug fixes and some refactorings