#24260: Add migration support for logical field renames
-----------------------------+------------------------------------
     Reporter:  pennersr     |                    Owner:  nobody
         Type:  New feature  |                   Status:  new
    Component:  Migrations   |                  Version:  1.7
     Severity:  Normal       |               Resolution:
     Keywords:               |             Triage Stage:  Accepted
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+------------------------------------

Comment (by pennersr):

 That does not seem to help. If I add the following migration:

 {{{
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals

 from django.db import models, migrations


 class Migration(migrations.Migration):

     dependencies = [
         ('foo', '0001_initial'),
     ]

     operations = [
         migrations.AlterField(
             model_name='foo',
             name='id',
             field=models.AutoField(serialize=False, primary_key=True,
 db_column=b'foo_id'),
             preserve_default=False,
         ),
     ]
 }}}

 Then:

 {{{
 python manage.py makemigrations foo
 You are trying to add a non-nullable field 'id' to foo without a default;
 we can't do that (the database needs something to populate existing rows).
 Please select a fix:
  1) Provide a one-off default now (will be set on all existing rows)
  2) Quit, and let me add a default in models.py
 Select an option:
 }}}

 Putting some dummy `default=0` or something in the migration does not help
 either.

--
Ticket URL: <https://code.djangoproject.com/ticket/24260#comment:3>
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/066.fa847b6bc7b470f99fef56510094bcdf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to