Context:
In an app called "exams", I have a model named Capture which has a unique 
CharField named "uuid". I was trying to convert this field to a UUIDField 
and I was getting this error:
django.db.utils.ProgrammingError: operator class "varchar_pattern_ops" does 
not accept data type uuid

Looking at the postgres table I found this index
"exams_capture_uuid_4a3af4ea353edaa5_like" btree (uuid varchar_pattern_ops)
However, the migration was trying to drop an index by a different name
DROP INDEX IF EXISTS "exams_capture_uuid_0c20e2c2_like";
Works correctly if I add a RunSQL migration to remove the culprit.

So I'm wondering where did the other index name come from? We never mess 
with postgres schema without going through Django ORM.
Originally, the table was created in Django 1.11, and, currently, we're on 
Django 4.04. Did something change between versions that caused index naming 
to be different? I checked the initial migration with sqlmigrate and even 
that shows the new index name.

Is there a way to work around this without hardcoding index name in raw sql?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7e854d78-2b24-4e52-b385-239ea9b8d288n%40googlegroups.com.

Reply via email to