﻿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
24435	Removing blank=True, null=True from ManyToMany field causes data deletion in migration	Mark Tranchant	Markus Holtermann	"My app has a Group model with an m2m field in it which used to look like:

{{{ things = models.ManyToManyField(Thing, blank=True, null=True) }}}

Django 1.8a1 on my test environment warned me that the {{{blank}}} and {{{null}}} arguments were unnecessary, so I removed them:

{{{ things = models.ManyToManyField(Thing) }}}

Then I ran {{{manage.py makemigrations}}} and applied the resulting migration with {{{manage.py migrate}}}. To my horror, the data in the relevant ""linking"" table was all deleted.

The section from the migration file looks like this:

{{{
    operations = [
        migrations.RemoveField(
            model_name='group',
            name='things',
        ),
        migrations.AddField(
            model_name='group',
            name='things',
            field=models.ManyToManyField(to='sa.Thing'),
        ),
    ]
}}}

This doesn't look like the right behaviour to me, and cost me a lot of time recovering data from backup. Have I done something wrong (other than trusting the migration file without inspecting it) or is this a genuine bug?
"	Bug	closed	Migrations	1.8beta1	Release blocker	fixed	m2m migrations deletion blank null	Markus Holtermann	Ready for checkin	1	0	0	0	0	0
