#27742: Unexpected migration on Parent -> child model inheritence
-----------------------------------------+------------------------
               Reporter:  Anthony King   |          Owner:  nobody
                   Type:  Bug            |         Status:  new
              Component:  Uncategorized  |        Version:  1.11
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 After upgrading to 1.11, migrations are generated on unchanged fields for
 parent pointers.


 models.py
 {{{#!python
 class Parent(models.Model):
     pass


 class Child(Parent):
     pass
 }}}

 initial_migration.py
 {{{#!python
 # -*- coding: utf-8 -*-
 # Generated by Django 1.10.5 on 2017-01-18 11:06
 from __future__ import unicode_literals

 from django.db import migrations, models
 import django.db.models.deletion


 class Migration(migrations.Migration):

     dependencies = [
         ('app', '0263_previous_migration'),
     ]

     operations = [
         migrations.CreateModel(
             name='Parent',
             fields=[
                 ('id', models.AutoField(auto_created=True,
 primary_key=True, serialize=False, verbose_name='ID')),
             ],
         ),
         migrations.CreateModel(
             name='Child',
             fields=[
                 ('parent_ptr', models.OneToOneField(auto_created=True,
 on_delete=django.db.models.deletion.CASCADE, parent_link=True,
 primary_key=True, serialize=False, to='app.Parent')),
             ],
             bases=('app.parent',),
         ),
     ]

 }}}


 post upgrade migration.py

 {{{#!python
 # -*- coding: utf-8 -*-
 # Generated by Django 1.11a1 on 2017-01-18 11:06
 from __future__ import unicode_literals

 from django.db import migrations, models
 import django.db.models.deletion


 class Migration(migrations.Migration):

     dependencies = [
         ('app', '0264_child_parent'),
     ]

     operations = [
         migrations.AlterField(
             model_name='child',
             name='parent_ptr',
             field=models.OneToOneField(auto_created=True,
 on_delete=django.db.models.deletion.CASCADE, parent_link=True,
 primary_key=True, to='app.Parent'),
         ),
     ]

 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27742>
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/052.477c3018d04b259db27a03a8bc298e0c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to