I agree this limitation of `contrib.contenttypes` is a bit unexpected. Not 
saying we should lift it but it does seem arbitrary even if having such 
large table names could be considered bad practice.

One approach we could take that doesn't involve any migration is to 
fallback to hashing of the overflowing characters.

That's the approach taken by the ORM when generating identifiers (e.g. 
index names) that might overflow the identifier limit of a backend[0]

Simon
[0] 
https://github.com/django/django/blob/60626162f76f26d32a38d18151700cb041201fb3/django/db/backends/utils.py#L196-L221

Le mardi 11 août 2020 à 05:54:02 UTC-4, Mariusz Felisiak a écrit :

> *contenttypes* should support all backends,  You need to remember about 
> DB-restrictions, e.g. we cannot change `ContentType.model` to a `TextField` 
> because TEXT columns cannot be used in unique constraints on MySQL. See 
> similar 
> discussion <https://groups.google.com/g/django-developers/c/h98-oEi7z7g> 
> about `User.last_name`.
>
> Best,
> Mariusz
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/2995ba70-6a19-4f11-a8a0-b62539d923can%40googlegroups.com.

Reply via email to