Fix migration 5

Migration 5 doesn't work because it's missing definitions for Team and
User. I'm not sure if it worked before. It's possible it stopped working
with all the updates. I didn't spend much time looking into it.