django-rest-passwordreset icon indicating copy to clipboard operation
django-rest-passwordreset copied to clipboard

Django OperationalError 1075, 'Incorrect table definition' multiple auto column issue.

Open Ebtessam opened this issue 5 years ago • 3 comments

Running version 0.9.7 on a MariaDB docker container.

root@ac695e436a58:/# mysql -V
mysql  Ver 15.1 Distrib 10.3.17-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

Getting this SQL error when running migrations.

django.db.utils.OperationalError: (1075, 'Incorrect table definition; there can be only one auto column and it must be defined as a key')

Here's part of the traceback:

  Applying django_rest_passwordreset.0002_pk_migration...ALTER TABLE `django_rest_passwordreset_resetpasswordtoken` ADD COLUMN `id` integer NULL; (params [])
ALTER TABLE `django_rest_passwordreset_resetpasswordtoken` ALTER COLUMN `id` DROP DEFAULT; (params [])
ALTER TABLE `django_rest_passwordreset_resetpasswordtoken` MODIFY `id` integer AUTO_INCREMENT NULL; (params [])

This is mentioned in several old issues but supposedly version 0.9.6, 0.9.7 solved it. But it seems to be an issue for me am I missing something?

Thank you :)

Ebtessam avatar Feb 08 '20 14:02 Ebtessam

Sorry for the late reply! Is this still an issue for you?

I've just tried it on a fresh install with 10.1.44-MariaDB and django-rest-passwordreset-1.1.0 and had no issues running the migrations.

anx-cbenke avatar Jul 30 '20 11:07 anx-cbenke

Same problem here.

Running migrations: Applying django_rest_passwordreset.0002_pk_migration...Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.9/site-packages/django/db/backends/mysql/base.py", line 73, in execute return self.cursor.execute(query, args) File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 206, in execute res = self._query(query) File "/usr/local/lib/python3.9/site-packages/MySQLdb/cursors.py", line 319, in _query db.query(q) File "/usr/local/lib/python3.9/site-packages/MySQLdb/connections.py", line 259, in query _mysql.connection.query(self, query) MySQLdb._exceptions.OperationalError: (1075, 'Incorrect table definition; there can be only one auto column and it must be defined as a key')

Running

  • mysql:8.0 inside Docker
  • django-rest-passwordreset==1.2.0

Thanks!

ebadia avatar Aug 31 '21 11:08 ebadia

All working now. Just reset migrations to zero and recreate all tables for django_rest_passwordreset. Thanks!

ebadia avatar Aug 31 '21 11:08 ebadia