#25313: Document how to migrate from a built-in User model to a custom User 
model
-------------------------------+------------------------------------
     Reporter:  Carl Meyer     |                    Owner:  nobody
         Type:  New feature    |                   Status:  new
    Component:  Documentation  |                  Version:  1.8
     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 Max F.):

 The procedure in comment:24 worked perfectly for me on MySQL (ubuntu
 16.04) and on SQLite (macOS 11.2.3). I had made a couple mistakes on my
 first attempt and wanted to leave some feedback for others going through
 the process:
 1. In the `change_user_type` function I mistakenly didn't change
 `ct.app_label = 'user'` to my apps name.. :(
 2. I added `elidable=True` to the RunPython operation so that I could
 squash the migrations later on

 Quick side note, when renaming the `auth_user` table I did run into an
 issue with my CI when using ubuntu 16.04. It was fixed when I upgraded to
 20.04 LTS but for reference this was the message: ''Renaming the
 'auth_user' table while in a transaction is not supported on SQLite < 3.26
 because it would break referential integrity. Try adding `atomic = False`
 to the Migration class.''

 Thanks for the explanation Johannes!

-- 
Ticket URL: <https://code.djangoproject.com/ticket/25313#comment:25>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.6cd80b7dfedbda74dd8c92208feb6b34%40djangoproject.com.

Reply via email to