Code

Ticket #7789: django-mysql-case-sensitive-unique.patch

File django-mysql-case-sensitive-unique.patch, 590 bytes (added by David Danier <goliath.mailinglist@…>, 6 years ago)

Patch adding BINARY to VARCHAR() to fix case insensitive match in get_or_create() on MySQL

  • django/db/backends/mysql/creation.py

     
    55DATA_TYPES = { 
    66    'AutoField':         'integer AUTO_INCREMENT', 
    77    'BooleanField':      'bool', 
    8     'CharField':         'varchar(%(max_length)s)', 
     8    'CharField':         'varchar(%(max_length)s) BINARY', 
    99    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)', 
    1010    'DateField':         'date', 
    1111    'DateTimeField':     'datetime',