-
Notifications
You must be signed in to change notification settings - Fork 653
Gh login cant be unique #1109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gh login cant be unique #1109
Conversation
This should have no effect on production.
This is the latest user that crates.io knows about with this username.
fa0b577
to
40ca32d
Compare
-- Its sole purpose is to fix the local database of anyone who ran 2017-09-26-200549 locally-- | ||
-- that migration can't be run on production because lower(gh_login) isn't unique on production. | ||
|
||
CREATE INDEX IF NOT EXISTS index_users_gh_login ON users (gh_login); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still want this index to be on the lowercase name though, don't we? Should we have another migration that is along the lines of:
DROP INDEX index_users_gh_login;
CREATE INDEX lower_gh_login ON users (lower(gh_login));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, good call!
05e7b81
to
e691e75
Compare
hows about now @sgrif ? |
bors: r+ |
1109: Gh login cant be unique r=sgrif So I can't deploy to production right now because of the unique index added to users.gh_login. The values on production for gh_login aren't unique, and here's why: - Someone can sign up for github with username whatever. - They can sign in to crates.io. We now get their gh_id, say, 3 (which *is* unique) and their gh_login, whatever. Their user account gets crates.io id 10. - They rename or delete their github account, which leaves the username 'whatever' available again. (If they renamed their github account, their gh_id stays stable and we'd migrate their account to their new username next time they log in) - Someone else signs up for github with username wHaTeVeR. - They can sign in to crates.io. We now get their gh_id, 9000, and their gh_login, wHaTeVeR. Their user account gets crates.io id 10000. We can't get rid of the first whatever account, because they might sign in again with a renamed account but the same id, and they should be able to still access the crates they own and all that. All we know is that the account with the latest crates.io id for that lower(gh_login) is the last valid account we know of for that username (and should match the account that you click through to github, as long as they haven't renamed or deleted their github account since). r? @sgrif
Build succeeded |
So I can't deploy to production right now because of the unique index added to users.gh_login.
The values on production for gh_login aren't unique, and here's why:
We can't get rid of the first whatever account, because they might sign in again with a renamed account but the same id, and they should be able to still access the crates they own and all that.
All we know is that the account with the latest crates.io id for that lower(gh_login) is the last valid account we know of for that username (and should match the account that you click through to github, as long as they haven't renamed or deleted their github account since).
r? @sgrif