This is only a quickfix and the actual SQL may differ depending on your DB. Tell us more about your setup. If possible add a github issue at https://github.com/owncloud/core/issues/new
I actually fixed this by reverting to last nights backup and running the whole upgrade again. There are still issues with the upgrade process - but I'll lodge these in different tickets - as they seem to be completely separate issues.