Opened 9 years ago
Closed 9 years ago
#26740 closed Bug (duplicate)
"Key column doesn't exist in table" when adding an index field then renaming it in the same migration in MySQL/PostgreSQL
Description ¶
From what I gathered, the index is created at the end of the migration, however the field no longer exists under the same name.
To replicate:
Configure MySQL in the settings.
migrations:
operations = [ migrations.CreateModel( name='TestModel', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ], ), migrations.AddField('testmodel', 'field', models.CharField(db_index=True, default='', max_length=255)), migrations.RenameField('testmodel', 'field', 'field2'), ]
django.db.utils.OperationalError: (1072, "Key column 'field' doesn't exist in table")
Note:
See TracTickets
for help on using tickets.
Duplicate of #25530