Re: [Model, ORM] Disabling a field before actually removing it

2019-06-29 Thread 'Matthieu Rudelle' via Django users
For Info, the discussion on django-developers : https://groups.google.com/forum/#!topic/django-developers/Gr9x2OlWYN4 On Monday, June 24, 2019 at 3:01:55 PM UTC+2, Matthieu Rudelle wrote: > > From the tests we conducted, even fields that are nullable and that are > not used in the code require

Re: [Model, ORM] Disabling a field before actually removing it

2019-06-24 Thread Matthieu Rudelle
>From the tests we conducted, even fields that are nullable and that are not used in the code require the underlying column to be present on DB. So as soon as the new release migrates the DB and gets rid of the column. The previous release (that is still running on this DB) complains that the

Re: [Model, ORM] Disabling a field before actually removing it

2019-06-24 Thread Vinicius Assef
I would, before everything, deploy code to stop using the field. After that, I would make it nullable and, then, remove it from the table. On Mon, 24 Jun 2019 at 05:32, Matthieu Rudelle wrote: > Yep, that's what we're planning on doing. > > It's kind of hacky though, it requires to warn all

Re: [Model, ORM] Disabling a field before actually removing it

2019-06-24 Thread Matthieu Rudelle
Yep, that's what we're planning on doing. It's kind of hacky though, it requires to warn all contributors to not makemigrations or to manually remove the field removal from the generated migration until the new release (and to ignore the screams of CI/CD tools ^^). Thanks for your response,

Re: [Model, ORM] Disabling a field before actually removing it

2019-06-21 Thread George Silva
The answer is indeed to split this into steps. First step is to allow the field to be nullable if it's not already. Deploy. Then you create a new deploy (not PR) that stops using the field altogether from all the codebase. You can remove the reference to the field or comment it out. Do not

Re: [Model, ORM] Disabling a field before actually removing it

2019-06-20 Thread Matthieu Rudelle
Thank you for the quick answer, although I am not sure what the second step mean and how it actually solves the problem? The missing column error appears even when no backward migration is called. Both version of the app run side by side, both connected to a single DB migrated with the new

Re: [Model, ORM] Disabling a field before actually removing it

2019-06-20 Thread Aldian Fazrihady
My solution to this problem was by adding more migrations steps: 1. Step to make the field nullable. 2. Backward step to fill value to the removed field. 3. Step to remove the field. Regards, Aldian Fazrihady On Thu, 20 Jun 2019, 19:37 Matthieu Rudelle, wrote: > Hi there! > > I am about to

[Model, ORM] Disabling a field before actually removing it

2019-06-20 Thread Matthieu Rudelle
Hi there! I am about to file a feature request but I figured this might have been discussed (although I can't find where). The use case is when removing fields in a production environment. We run our django migrations without downtimes, such that basically, from time to time we have an old