Revert case sensitivity for email uniqueness #930
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi everyone and thanks for maintaining the gem ❤️
Unfortunately, we ran into an issue after we updated Clearance to the latest version: some of our requests started failing due to statement timeouts in the database.
After a closer inspection it turned out the problem was related to queries on the
users
table which were changed to query byLOWER(email)
instead ofemail
. Since we didn't have the index onLOWER(email)
, the queries for some users got significantly slower.This is related to the change made in #889—
case_sensitive
setting of theuniqueness
validator was setto
false
to prevent deprecation warnings from Rails.However, the setting should have been set to
true
to preserve backwards-compatibility.The deprecation warning said:
The problem was mentioned in an old commit that originally made the switch from the explicit
false
to the implicittrue
:56f0f04
If I might recommend pushing this change in a bugfix release and if
case_sensitive: false
is indeed desired, push that change in Clearance 3.0.