﻿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
32206	Incorrect migration generated if field has been renamed when it has verbose_name set	Peter Inglesby	Hasan Ramezani	"If you start with following model:


{{{
class Thing(models.Model):
    name = models.CharField(max_length=100, default=""xxx"", verbose_name=""name"")
}}}

and change it to:


{{{
class Thing(models.Model):
    label = models.CharField(max_length=100, default=""xxx"", verbose_name=""name"")
}}}

Django asks:


{{{
Did you rename thing.name to thing.label (a CharField)? [y/N] y
}}}

and if you say yes, it creates a migration with:


{{{
    operations = [
        migrations.RenameField(
            model_name='thing',
            old_name='name',
            new_name='label',
        ),
    ]
}}}

But if you change it to:


{{{
class thing(models.model):
    label = models.CharField(max_length=100, default=""xxx"", verbose_name=""label"")
}}}


if creates a migration with:


{{{
    operations = [
        migrations.RemoveField(
            model_name='thing',
            name='name',
        ),
        migrations.AddField(
            model_name='thing',
            name='label',
            field=models.CharField(default='xxx', max_length=100, verbose_name='label'),
        ),
    ]
}}}


If you were to run this migration without thinking, you would risk losing data."	Cleanup/optimization	closed	Migrations	3.1	Normal	duplicate			Accepted	1	0	0	0	0	0
