Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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/ #1399 #13465 gitlabhq/gitlabhq@c1dddf8 huginn/huginn#1330 (comment) 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).
- Loading branch information
Showing with 86 additions and 12 deletions.
- +8 −0 activerecord/CHANGELOG.md
- +1 −1 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
- +14 −0 activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
- +1 −1 activerecord/lib/active_record/validations/uniqueness.rb
- +45 −0 activerecord/test/cases/validations/uniqueness_validation_test.rb
- +17 −10 activerecord/test/schema/schema.rb