#22837: Migrations detect unnessecary(?) changes
-------------------------------+--------------------------------------
     Reporter:  valberg        |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  closed
    Component:  Migrations     |                  Version:  1.7-beta-2
     Severity:  Normal         |               Resolution:  invalid
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------

Comment (by MarkusH):

 Replying to [comment:3 pykler]:
 > Tell me what the correct behaviour is in the following scenario
 (according to the ticket close comment, this is a scenario that is
 designed for).
 >
 > {{{
 > 0001 migration   choices are ('a', 'apple'), ('b', 'banana')
 > 0002 data        insert into table choice 'banana'
 > 0003 migration   model has only one choice now ('a', 'apple')
 > }}}
 >
 > From my tests, django doesn't (and 100% defenitely shouldn't) be
 deleting data or replacing data in every record of my database table on
 migration 0003. So the reality is, this point in time validation check is
 really only for checking if the choice is valid during the data migration
 which isn't really useful.

 Django will **not** go through your database table and remove all rows
 with 'banana'. But you could add another migration that selects all rows
 that don't have valid data and work with them on your own. And you can
 only do that if you have `choices` in your field definition.

 > The problem with this design is some apps (third party) will have a
 dynamic set of choices depending on your settings, so they cannot reliably
 deliver a set of migrations causing the user of the app to have to create
 migrations on behalf of the third party app.

 They can, by passing a callable to `choices`. See #13181

--
Ticket URL: <https://code.djangoproject.com/ticket/22837#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.075cf25b4f84a2c558f0be0c777a8de2%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to