#21638: Infinite migrations when using AUTH_USER_MODEL
----------------------------+------------------------------------
     Reporter:  patrick@…   |                    Owner:
         Type:  Bug         |                   Status:  new
    Component:  Migrations  |                  Version:  master
     Severity:  Normal      |               Resolution:
     Keywords:              |             Triage Stage:  Accepted
    Has patch:  0           |      Needs documentation:  0
  Needs tests:  0           |  Patch needs improvement:  0
Easy pickings:  0           |                    UI/UX:  0
----------------------------+------------------------------------

Comment (by patrick@…):

 In django/db/migrations/autodetector.py line 241, the old version of the
 username field is compared against the current username field. Both the
 old and new username fields have their own separate instance of a
 django.core.validators.RegexValidator. The two RegexValidator objects have
 the exact same values, but because they are separate instances and do not
 have a comparison function they always compare as unequal.

 Some possible solutions:

 1) Ignore validators when comparing fields. My understanding is that the
 validators only affect data and do not influence the database schema, but
 I haven't fully explored their usage. I believe something similar was
 proposed and turned down in ticket #21275 because the validators may still
 be useful during the migration process.

 2) Add an {{{__eq__}}} function to the RegexValidator class. This is quick
 and easy, but the other validator classes may need this also to prevent
 the same error in the future.

 I'd be willing to contribute a patch, but I don't want to prescribe a
 solution without feedback from maintainers who understand the overall
 system better than I do.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21638#comment:3>
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/088.4d10f827c351baac575c222649cf4be3%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to