#23048: Add the ability to make RemoveField reversible for non-null fields
---------------------------------+------------------------------------
Reporter: Harris Lapiroff | Owner: nobody
Type: New feature | Status: closed
Component: Migrations | Version: 1.7-rc-1
Severity: Normal | Resolution: wontfix
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 rm_):
Found this debugging a similar issue. My problem comes from having some
migrations tests that test a specific migrations for a field that I'm
trying to remove. So in my migrations history I have: addfield -> make
nullable -> remove field
I've tried to add a default as suggested above:
- field=models.ForeignKey(blank=True, null=True,
on_delete=django.db.models.deletion.CASCADE,
to='translatable_messages.Language'),
+ field=models.ForeignKey(blank=True, null=True,
on_delete=django.db.models.deletion.CASCADE,
to='translatable_messages.Language', default=1),
+ preserve_default=False
but instead of postgres warning about the field having null values when
it's not supposed to i get this:
django.db.utils.OperationalError: cannot ALTER TABLE
"translatable_messages_translatablemessage" because it has pending trigger
events
I'm tempted to remove the tests on the migrations and call it a day but
maybe there's something else I can do?
--
Ticket URL: <https://code.djangoproject.com/ticket/23048#comment:7>
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/072.fb3e9375afa387a42f07082ff892d491%40djangoproject.com.