[Django] #26594: Text in migration prompt is scary and (slightly) wrong

21 views
Skip to first unread message

Django

unread,
May 6, 2016, 8:11:18 PM5/6/16
to django-...@googlegroups.com
#26594: Text in migration prompt is scary and (slightly) wrong
--------------------------------------+--------------------
Reporter: mlissner | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: 1.9
Severity: Normal | Keywords: terror
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
I just did the following:

- Converted a field to non-nullable in my model.
- Created a migration
- Had the following interaction:


{{{
You are trying to change the nullable field 'pacer_case_id' on docket to
non-nullable 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)
2) Ignore for now, and let me handle existing rows with NULL myself (e.g.
because you added a RunPython or RunSQL operation to handle NULL values in
a previous data migration)
3) Quit, and let me add a default in models.py
Select an option: 1
Please enter the default value now, as valid Python
The datetime and django.utils.timezone modules are available, so you can
do e.g. timezone.now()
>>> ''
}}}


You can see that I entered (blank) for all the null values.

Next, I went to the production server and started deploying the migration.
This is when I wondered, wait, did I just set *every* value to blank, or
just the null ones?

And I went and read the prompt from a moment ago and saw:


{{{
Provide a one-off default now (will be set on all existing rows)
}}}

(will be set on all existing rows)

WILL BE SET ON ALL EXISTING ROWS.

== WILL BE SET ON ALL EXISTING ROWS! ==

----

Well, that terrified me for a moment.

I suggest we change this to say:

{{{
(will be set on all existing null-value rows)
}}}

Or something to that effect.

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

Django

unread,
May 6, 2016, 8:22:28 PM5/6/16
to django-...@googlegroups.com
#26594: Text in migration prompt is scary and (slightly) wrong
-------------------------------------+-------------------------------------
Reporter: mlissner | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Migrations | Version: 1.9
Severity: Normal | Resolution: duplicate

Keywords: terror | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* needs_docs: => 0
* resolution: => duplicate
* needs_tests: => 0
* needs_better_patch: => 0


Comment:

Sorry for the scare. Duplicate of #26075.

--
Ticket URL: <https://code.djangoproject.com/ticket/26594#comment:1>

Reply all
Reply to author
Forward
0 new messages