﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26740	"""Key column doesn't exist in table"" when adding an index field then renaming it in the same migration in MySQL/PostgreSQL"	Gagaro	nobody	"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"")
}}}"	Bug	closed	Migrations	dev	Normal	duplicate			Unreviewed	0	0	0	0	0	0
