#30870: "migrate --plan" outputs "IRREVERSIBLE" on RunPython operations without
docstrings.
-------------------------------------+-------------------------------------
     Reporter:  Kyle Dickerson       |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Management     |                  Version:  2.2
  commands)                          |
     Severity:  Release blocker      |               Resolution:
     Keywords:  migrate              |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * severity:  Normal => Release blocker
 * stage:  Unreviewed => Accepted


Comment:

 Thanks for this report.

 > However, a more holistic view suggests that displaying "IRREVERSIBLE"
 isn't really the correct thing to do. "IRREVERSIBLE" is set when is_error
 is also set to True and seems to be trying to indicate that the migration
 operation is invalid rather than irreversible. That is, if
 code/reverse_code is None (line 348) or sql/reverse_sql is None (line 351)
 the migration can't run.

 `IRREVERSIBLE` doesn't mean that migrations are invalid, it means that you
 cannot reverse them. `is_error` is to emphasize this as a warning
 (probably name is misleading). IMO a one line fix is acceptable for
 backporting
 {{{
 diff --git a/django/core/management/commands/migrate.py
 b/django/core/management/commands/migrate.py
 index 37914e2622..5b5b96d1da 100644
 --- a/django/core/management/commands/migrate.py
 +++ b/django/core/management/commands/migrate.py
 @@ -345,7 +345,7 @@ class Command(BaseCommand):
          prefix = ''
          if hasattr(operation, 'code'):
              code = operation.reverse_code if backwards else
 operation.code
 -            action = code.__doc__ if code else ''
 +            action = (code.__doc__ or '') if code else ''
          elif hasattr(operation, 'sql'):
              action = operation.reverse_sql if backwards else
 operation.sql
          else:
 }}}

 We could accept some refactoring with a `reversible` property but this
 should be done as a cleanup only on master.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30870#comment:1>
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.9440df488f2e1b35f73c40871c3e09d7%40djangoproject.com.

Reply via email to