Make Your Database Field CaseSensitive
By Default the database fields you use are case insensitive. To modify your field to make it case sensitive. Create a migration and add this line to it.
execute("ALTER TABLE users MODIFY `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL;")
In the above snippet, we are making the database field case sensitive by changing the datatype of the field from a "varchar" to utf8 COLLATE.
Written by Rajeev N Bharshetty
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#