unicef / iogt

BSD 2-Clause "Simplified" License
25 stars 35 forks source link

Make sure the Users migration command doesn't duplicate data #534

Open ehmadzubair opened 3 years ago

ehmadzubair commented 3 years ago

The User migration command is non-destructive in the sense that it doesn't delete the existing users data for migration. We have to make sure that it doesn't duplicate anything related to the users.

geoo89 commented 3 years ago

Comments, survey/poll submissions get duplicated. This should be fixed.

Users do not get duplicated, however there is an issue with duplicate names, see https://github.com/unicef/iogt/pull/473#pullrequestreview-746187499:

There was an admin user on the site before migrating. The second one (from the user migration) overwrote the first one, however when I tried to log in as admin (regardless of the password I used), I got an error:

MultipleObjectsReturned at /admin/login/
get() returned more than one User -- it returned 2!

I think it'd be preferable to keep the original user instead of migrating the other one, and warn that a user of that name already exists.