#26740: "Key column doesn't exist in table" when adding an index field then
renaming it in the same migration in MySQL/PostgreSQL
----------------------------+--------------------
     Reporter:  Gagaro      |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Migrations  |    Version:  master
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 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")
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26740>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.0ff84b513e1a84daf6ad17449c2b9e63%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to