﻿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
27339	Adding an AutoField prompts for a default which creates a broken migration	Tim Graham		"Change:
{{{
class Foo(models.Model):
    id = models.CharField(max_length=20, primary_key=True)
}}}
to:
{{{
class Foo(models.Model):
    character_id = models.AutoField(primary_key=True)
}}}
The created migration has these operations:
{{{
migrations.RemoveField(
    model_name='foo',
    name='id',
),
migrations.AddField(
    model_name='foo',
    name='character_id',
    field=models.AutoField(default=0, primary_key=True, serialize=False),
    preserve_default=False,
),
}}}
(entering 0 at the default prompt). Running the migration on PostgreSQL gives: `ProgrammingError: multiple default values specified for column ""character_id"" of table ""t27267_foo""`. I'm not sure if this can be made to work sensibly. Removing the default from the migration operation works, but if there's an existing data, the `character_id` field must be populated somehow (perhaps a `RunPython` could be done in the same migration?). #27338 is related. This was discovered while investigating #27267. 
"	Cleanup/optimization	new	Migrations	dev	Normal				Accepted	0	0	0	0	0	0
