#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.
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.c2a11e58b97ac5f3107cc1a87e503f77%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.