Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ebtessam opened this issue Feb 8, 2020 · 3 comments
Assignees

Comments

@Ebtessam
Copy link

Ebtessam commented Feb 8, 2020

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 :)

@ghost ghost assigned anx-cbenke Jul 30, 2020
@anx-cbenke
Copy link
Contributor

anx-cbenke commented Jul 30, 2020

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.

@ebadia
Copy link

ebadia commented Aug 31, 2021

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
Copy link

ebadia commented Aug 31, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants