Can not migrate database "BLOB/TEXT column 'md5_digest' used in key specification without a key length"
abehrad-ir opened this issue · 0 comments
I get this error when i try to migrate database with mysql for the first time:
Operations to perform:
Apply all migrations: admin, auth, contenttypes, django_telethon, sessions
Running migrations:
Applying contenttypes.0001_initial... OK
Applying auth.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying auth.0012_alter_user_first_name_max_length... OK
Applying django_telethon.0001_initial...Traceback (most recent call last):
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\backends\mysql\base.py", line 75, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\MySQLdb\cursors.py", line 330, in query
db.query(q)
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\MySQLdb\connections.py", line 255, in query
mysql.connection.query(self, query)
MySQLdb.OperationalError: (1170, "BLOB/TEXT column 'md5_digest' used in key specification without a key length")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Behrad\Projects\healfitbot\manage.py", line 22, in
main()
File "C:\Users\Behrad\Projects\healfitbot\manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\core\management_init.py", line 442, in execute_from_command_line
utility.execute()
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\core\management_init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\core\management\base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\core\management\base.py", line 458, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\core\management\base.py", line 106, in wrapper
res = handle_func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\core\management\commands\migrate.py", line 356, in handle
post_migrate_state = executor.migrate(
^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\migrations\executor.py", line 135, in migrate
state = self._migrate_all_forwards(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\migrations\executor.py", line 167, in _migrate_all_forwards
state = self.apply_migration(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\migrations\executor.py", line 249, in apply_migration
with self.connection.schema_editor(
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\backends\base\schema.py", line 166, in exit
self.execute(sql)
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\backends\base\schema.py", line 201, in execute
cursor.execute(sql, params)
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\backends\utils.py", line 102, in execute
return super().execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\backends\utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\backends\utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\backends\utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\db\backends\mysql\base.py", line 75, in execute
return self.cursor.execute(query, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\MySQLdb\cursors.py", line 179, in execute
res = self._query(mogrified_query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\MySQLdb\cursors.py", line 330, in _query
db.query(q)
File "C:\Users\Behrad\AppData\Local\Programs\Python\Python311\Lib\site-packages\MySQLdb\connections.py", line 255, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1170, "BLOB/TEXT column 'md5_digest' used in key specification without a key length")