-
Notifications
You must be signed in to change notification settings - Fork 210
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
[POOL-608] allow for case insensitive users search by email #1283
[POOL-608] allow for case insensitive users search by email #1283
Conversation
I believe we will need a partybus migration to deploy the new sqitch index on upgrades. |
b358900
to
50c6112
Compare
We've come to the conclusion that this is a cumbersome approach, and that it might be easier to get a migration in place for changing email's column type from I'll put this branch on hold and start another one for the migration. |
50c6112
to
8d50b22
Compare
After some more discussion, it might be the case that the best compromise is as follows:
That way we don't need a migration. Also, we wave off any guarantees of duplicate entries not happening -- they may be there already (and we can't fix those), so they may be added as well. They just may be there. |
This would be good to go. Just waiting for chef/chef-zero#265 to merge so we can drop 8d50b22. |
8d50b22
to
f401d6e
Compare
The chef-zero change this depends on has been merged ✔️ The only missing bit is asking ops if creating that index will be fine as-is for hosted. ✔️ |
|
||
-- TODO 2017/05/30 sr: check with ops if this should include CONCURRENTLY | ||
-- https://www.postgresql.org/docs/9.2/static/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY | ||
CREATE INDEX users_lower_email_idx ON users (lower(email)); |
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.
Perhaps we should only create the index if it doesn't exist, that way ops can deploy it different if they choose to and this will still be safe to run.
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.
Uhm, yeah, that's a good idea. CREATE INDEX IF NOT EXISTS it shall be.
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.
Unfortunately, I think CREATE INDEX IF NOT EXISTS isn't supported in 9.2. This stack-overflow answer presents alternatives for different versions:
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.
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.
It would have been sooo nice. But thanks! 😃
e227807
to
4069b32
Compare
I don't believe this has to be held back anymore. The index creation is done concurrently now, and the corresponding verification disabled. No user should be hurt in the process. |
4069b32
to
60f00a2
Compare
cc @chef/chef-server-maintainers |
37b429e
to
bbef679
Compare
Also adds tests to pedant that failed before. Signed-off-by: Stephan Renatus <srenatus@chef.io>
Signed-off-by: Stephan Renatus <srenatus@chef.io>
Signed-off-by: Stephan Renatus <srenatus@chef.io>
Signed-off-by: Stephan Renatus <srenatus@chef.io>
This doesn't work with PG 9.6. Signed-off-by: Stephan Renatus <srenatus@chef.io>
So far, this is for
GET /users?email=foo%40bar.com
, and adding an index to make this not super slow (not verified if it's strictly necessary, so if tests in hosted reveal that we don't need this, we could drop b358900).It doesn't yet forbid creating a second user with the same email (case sensitively).