OpenEugene / openboard

An open source switchboard, written in Elm and Go.
MIT License
21 stars 7 forks source link

Bug: UserService user table altmail column should not have to be unique #60

Closed codegold79 closed 4 years ago

codegold79 commented 5 years ago

Expected Behavior

Adding a user with a unique email and username, but having no altmail, will add a new user.

Actual Behavior

The previous user also without altmail will be overridden.

Steps To Reproduce The Problem

  1. create a new user with no altmail
  2. see that the number of rows is the same, indicating a different user was overridden

Additional Notes

Does username also have to be unique?

daved commented 4 years ago
codegold79 commented 4 years ago

@daved I see I had already fixed the issue, but forgot to close it out. Here's the commit here: https://github.com/OpenEugene/openboard/commit/8f03dff4a9fe22db7b8b38ddc43faa86a8bff5ee#diff-0894077ddab102f1439b337850739dfc

For more background information, the problem was in the MySQL table column setting for altmail. In the migration it was set as altmail VARCHAR(255) NOT NULL UNIQUE. What that meant was that if the altmail column for a new user was identical to another user, then that previous user would be overridden (even though they're not the same user).

The migration was fixed, and as long as --rollback, and then --migrate is used when starting up the openboard server the issue should no longer be happening.

I recommend closing this issue, unless there are other comments.

daved commented 4 years ago

Great, thanks!