[Fixed]-OperationalError1075 'Incorrect table definition'

0👍

So far the only “solution” was to trash all the migrations and re-create the database. Thus trashing all the old data. But it is less of a pain than fixing this craziness.

1👍

The Error1075 ‘Incorrect table definition’ came from Mysql, not Django. That is because the table u changed got 2 auto_created fields, while it is only one field alled allow for one table in Mysql.

In Django, just add a parm ‘auto_created’:

serial_number = models.AutoField(primary_key=True, auto_created=False)

then remove u old migrations file last time and make migrations again, continue migrate will be ok.

👤Xin Du

Leave a comment