Fix some more issues with SQL upgrade script:
- constraints on event table are only introduced later, so don't
  try to remove/add them.
- replace team login -> ID comment.
- unset defaults on teamid and mesgid in team_unread table.
Also convert old team logins to ID's when team.login column is present.