Opened 3 years ago
Last modified 3 years ago
#32900 closed Cleanup/optimization
Migrations questioner uses bad grammar — at Version 1
Reported by: | Christian Ullrich | Owned by: | nobody |
---|---|---|---|
Component: | Migrations | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description (last modified by )
The interactive questioner, when it asks what to do about changes in nullability or adding a NOT NULL field, provides multiple options. Some of these speak to the user, some as the user.
One example of several:
You are trying to add a non-nullable field 'id' to mymodel without a default; we can't do that (the database needs something to populate existing rows). Please select a fix: 1) Provide a one-off default now (will be set on all existing rows with a null value for this column) 2) Quit, and let me add a default in models.py
In option 1, Django offers the user the choice of entering the default value. Option 2 instead is the user telling Django what to do.
Each time I read this, I'm asking myself who the "me" in option 2 is. The most egregious case is in InteractiveMigrationQuestioner.ask_not_null_alteration(): "[...] let me handle existing rows [...] (e.g. because you added a RunPython [...]". In this sentence, "me" and "you" are the same.
Fix: Either reword the "provide" options to say "Let me enter a one-off default now", or the "let me" options to the same style as the "provide" options. I am very much in favor of the latter because I think this "me, the user" style is terrible.