Re: Data lost by a migration for renaming a field

2018-09-09 Thread Jason
> > I'm also thinking it might be much helpful to detect the rename as much as > possible and give warning message about developer has to modify the > migration to rename field properly > sure, but how would you do this? And how would you cover all the possible cases to detect whether the dev

Re: Data lost by a migration for renaming a field

2018-09-08 Thread chen
On Sunday, September 9, 2018 at 12:48:52 AM UTC+8, Jason wrote: > > https://docs.djangoproject.com/en/1.11/ref/migration-operations/#alterfield > > There are AlterField and RenameField operations available with migrations, > but you probably have to include them in your custom migrations. Reaso

Re: Data lost by a migration for renaming a field

2018-09-08 Thread Jason
https://docs.djangoproject.com/en/1.11/ref/migration-operations/#alterfield There are AlterField and RenameField operations available with migrations, but you probably have to include them in your custom migrations. Reason being, how would django know that you're just renaming a field and not

Data lost by a migration for renaming a field

2018-09-08 Thread chen
Hi, I have a model which contains a BooleanField. I changed its name to a new one and updated help text as well. django generates operations RemoveField and AddField in sequence for those changes. As a result of running this migration, original data is lost. I was confused by this behavior why