#34974: makemigrations --check does not show diff as documented
-----------------------------------------+------------------------
               Reporter:  Oliver Ford    |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  4.2
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 The [docs](https://docs.djangoproject.com/en/4.2/ref/django-admin/#django-
 admin-makemigrations) say:

 >--check¶
 >Makes makemigrations exit with a non-zero status when model changes
 without migrations are detected. **Implies --dry-run**.

 which:
 >--dry-run¶
 >**Shows what migrations would be made** without actually writing any
 migrations files to disk. Using this option along with --verbosity 3 will
 also show the complete migrations files that would be written.

 emphasis mine.

 In CI, would be very useful to have a single command which both renders
 the missing/problematic migration and also exits non-zero; I think this
 should be `makemigrations --check`, as it's already documented as doing.

 Alternatively, maybe `--check` should _not_ imply `--dry-run` at all in
 any sense - i.e. it should write to disk if `--dry-run` not given. I'm not
 sure I like that though, I think it makes sense that 'check' is
 idempotent.

 Black for example has `--diff` rather than `--dry-run`, and both prevent
 writing to disk, but can be combined for an exit code as well as the
 change printed:

 >--check                         Don't write the files back, just return
 the
                                   status. Return code 0 means nothing
 would
                                   change. Return code 1 means some files
 would
                                   be reformatted. Return code 123 means
 there
                                   was an internal error.

 >--diff                          Don't write the files back, just output a
                                  diff for each file on stdout.

 (can't figure out this formatting...)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34974>
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/0107018bdd6b25a2-d1732d01-082d-4a0a-a8a1-bd45b24dd5d7-000000%40eu-central-1.amazonses.com.

Reply via email to