_mysql_exceptions.OperationalError: (1170, "BLOB/TEXT column 'name' used in key specification without a key length")
MySQL doesn't allow you to create an index on a text field unless you specify the length of the index (e.g.
KEY pulp_app_workers_name (name(1000)). This is to prevent indexes from growing too large. We probably don't want to remove the key in which case we should either change the text fields to char fields or manually create the indexes in the db ourselves.
Here's how to search for the fields affected:
grep -r "TextField(db_index" *.py
#2 Updated by daviddavis almost 3 years ago
There are 5 instances in Pulp where we have TextFields with db indexes. They're all name fields. I noticed in some cases (e.g. ContentGuard, Distribution) we are using CharField. So to reiterate, the options are:
1. Change all names to use CharField and thus avoiding having to write raw SQL in our migrations
2. Write a migration with some raw sql to create the key with a length. I am not sure how db agnostic this is though.
#4 Updated by ttereshc almost 3 years ago
+1 to option 1, CharField.
In my opinion, we don't have a real need for TextField for names. And it seems that it's easier to stay DB-agnostic with a CharField and for some DBs it will also mean a performance gain (not for PostgreSQL though, it doesn't matter for it, AFAIK)
Please register to edit this issue