olivierdalang / django-toosimple-q

Simplistic task queue and cron-like scheduler for Django
MIT License
36 stars 6 forks source link

Problems with migrations #32

Open paulocoutinhox opened 2 days ago

paulocoutinhox commented 2 days ago

Hi,

Im trying execute migrations to MySQL but get this errors:

Applying toosimpleq.0004_auto_20200507_1339...Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/django/db/backends/utils.py", line 105, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/homebrew/lib/python3.10/site-packages/django/db/backends/mysql/base.py", line 76, in execute
    return self.cursor.execute(query, args)
  File "/opt/homebrew/lib/python3.10/site-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
  File "/opt/homebrew/lib/python3.10/site-packages/MySQLdb/cursors.py", line 330, in _query
    db.query(q)
  File "/opt/homebrew/lib/python3.10/site-packages/MySQLdb/connections.py", line 261, in query
    _mysql.connection.query(self, query)
MySQLdb.OperationalError: (1071, 'Specified key was too long; max key length is 3072 bytes')

and

Applying toosimpleq.0011_workerstatus...Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.10/site-packages/django/db/backends/utils.py", line 103, in _execute
    return self.cursor.execute(sql)
  File "/opt/homebrew/lib/python3.10/site-packages/django/db/backends/mysql/base.py", line 76, in execute
    return self.cursor.execute(query, args)
  File "/opt/homebrew/lib/python3.10/site-packages/MySQLdb/cursors.py", line 179, in execute
    res = self._query(mogrified_query)
  File "/opt/homebrew/lib/python3.10/site-packages/MySQLdb/cursors.py", line 330, in _query
    db.query(q)
  File "/opt/homebrew/lib/python3.10/site-packages/MySQLdb/connections.py", line 261, in query
    _mysql.connection.query(self, query)
MySQLdb.OperationalError: (1071, 'Specified key was too long; max key length is 3072 bytes')

The problems is related with this:

field=models.CharField(max_length=1024, unique=True),

Can you fix this?

Thanks.

paulocoutinhox commented 2 days ago

I put 512 only to execute migration and bypass the error. But if i try change it by database from 512 to 1024, i get the same error:

image
paulocoutinhox commented 2 days ago

The varchar from toosimpleq_taskexec works with 1024, but because it is not a unique key.