my platform: django 1.1.1, mysql 5.0.67, python 2.6.2
why does syncdb complain
CharField cannot have a "max_length" greater than 255 when using
"unique=True"
when mysql 5.0.67 does allow greater tan 255? is there a way to
override or ignore this error?
this works in mysql
mysql> create table mbg_test_1 (id int(5), url varchar(760) not null,
primary key (id), unique (url));
Query OK, 0 rows affected (0.00 sec)
mysql> desc mbg_test_1;
+-------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+--------------+------+-----+---------+-------+
| id | int(5) | NO | PRI | 0 | |
| url | varchar(760) | NO | UNI | NULL | |
+-------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql>
but a Model with
url = models.CharField('Full URL', max_length=760, unique=True)
yields an error from syncdb:
$ manage.py syncdb
Error: One or more models did not validate:
threats.threat: "url": CharField cannot have a "max_length" greater
than 255 when using "unique=True".
$
not sure why django hits this error since the true max length is 767,
not 255:
mysql> create table mbg_test_1 (url varchar(999) not null, unique
(url));
ERROR 1071 (42000): Specified key was too long; max key length is 767
bytes
mysql>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.