edited sql upgrade for rebase

Self committed/reviewed/integrated code pushed to master ahead of other
commits, requires all other contributions to rebase code in review.