fixed database upgrade scripts for python2.6