From 9def05385f1cfa41924bb93daa187615e88c95b9 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 21 Feb 2019 17:30:27 +0900 Subject: Deprecate mismatched collation comparison for uniquness validator In MySQL, the default collation is case insensitive. Since the uniqueness validator enforces case sensitive comparison by default, it frequently causes mismatched collation issues (performance, weird behavior, etc) to MySQL users. https://grosser.it/2009/12/11/validates_uniqness_of-mysql-slow/ https://github.com/rails/rails/issues/1399 https://github.com/rails/rails/pull/13465 https://github.com/gitlabhq/gitlabhq/commit/c1dddf8c7d947691729f6d64a8ea768b5c915855 https://github.com/huginn/huginn/pull/1330#discussion_r55152573 I'd like to deprecate the implicit default enforcing since I frequently experienced the problems in code reviews. Note that this change has no effect to sqlite3, postgresql, and oracle-enhanced adapters which are implemented as case sensitive by default, only affect to mysql2 adapter (I can take a work if sqlserver adapter will support Rails 6.0). --- activerecord/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index 42c0e6a190..ec412c2a9d 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,11 @@ +* Deprecate mismatched collation comparison for uniquness validator. + + Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1. + To continue case sensitive comparison on the case insensitive column, + pass `case_sensitive: true` option explicitly to the uniqueness validator. + + *Ryuta Kamizono* + * Add `reselect` method. This is a short-hand for `unscope(:select).select(fields)`. Fixes #27340. -- cgit v1.2.3