[Django] #34632: Let makemigrations output an error message with --check

13 views
Skip to first unread message

Django

unread,
Jun 5, 2023, 6:14:26 AM6/5/23
to django-...@googlegroups.com
#34632: Let makemigrations output an error message with --check
------------------------------------------------+------------------------
Reporter: ProbstDJakob | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Migrations | 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 |
------------------------------------------------+------------------------
With the [[https://github.com/django/django/pull/15845|PR 15845]]
regarding the Issue #34051 the option `--check` does not output any errors
when changes have been detected. This seems counter intuitive for at least
unix users. Command line tools for unix typically do not output anything
if everything goes well but print an error message if something went
wrong. Furthermore if the command is run in a pipeline it is not possible
to know for certain if the command failed because of a wrongly set up
pipeline job or if a migration is actually missing. Outputting the
detected changes also leverages the person looking into the pipeline job
to know what is missing without the need to check out the changes and
actually create the migration, thus giving the person the opportunity to
make further decisions. A possible solution could be to make the flag
`--check` imply the flag `--dry-run` and move the `if check_changes:` back
down.

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

Django

unread,
Jun 5, 2023, 6:26:18 AM6/5/23
to django-...@googlegroups.com
#34632: Let makemigrations output an error message with --check
-------------------------------------+-------------------------------------
Reporter: Jakob Probst | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Migrations | Version: 4.2
Severity: Normal | Resolution: wontfix

Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* cc: Jacob Walls (added)
* status: new => closed
* resolution: => wontfix


Comment:

Thanks for the report (partly related with #34436), however, this is a
documented and intended change.

> Furthermore if the command is run in a pipeline it is not possible to
know for certain if the command failed because of a wrongly set up
pipeline job or if a migration is actually missing.

You can always check a status code. I don't think outputting an error
message will improve it somehow.

Please first start a discussion on the DevelopersMailingList, where you'll
reach a wider audience and see what other think, and
[https://docs.djangoproject.com/en/stable/internals/contributing/triaging-
tickets/#closing-tickets follow the triaging guidelines with regards to
wontfix tickets].

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

Django

unread,
Jun 5, 2023, 6:48:46 AM6/5/23
to django-...@googlegroups.com
#34632: Let makemigrations output an error message with --check
-------------------------------------+-------------------------------------
Reporter: Jakob Probst | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Migrations | Version: 4.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by David Sanders):

This is also related to #34457: makemigrations --check no longer prints
the changes.

> A possible solution could be to make the flag --check imply the flag
--dry-run

This is what I was proposing in my PR :P

--
Ticket URL: <https://code.djangoproject.com/ticket/34632#comment:2>

Django

unread,
Jun 5, 2023, 7:06:56 AM6/5/23
to django-...@googlegroups.com
#34632: Let makemigrations output an error message with --check
-------------------------------------+-------------------------------------
Reporter: Jakob Probst | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Migrations | Version: 4.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Jakob Probst):

Did you you open a discussion on the developer mailing list?

--
Ticket URL: <https://code.djangoproject.com/ticket/34632#comment:3>

Django

unread,
Jun 5, 2023, 7:10:39 AM6/5/23
to django-...@googlegroups.com
#34632: Let makemigrations output an error message with --check
-------------------------------------+-------------------------------------
Reporter: Jakob Probst | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Migrations | Version: 4.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by David Sanders):

Replying to [comment:3 Jakob Probst]:


> Did you you open a discussion on the developer mailing list?

Nope, feel free to start a discussion 👍

--
Ticket URL: <https://code.djangoproject.com/ticket/34632#comment:4>

Django

unread,
Jun 22, 2023, 8:09:12 AM6/22/23
to django-...@googlegroups.com
#34632: Let makemigrations output an error message with --check
-------------------------------------+-------------------------------------
Reporter: Jakob Probst | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Migrations | Version: 4.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Lukas von Allmen):

We encountered the same issue as we used the command in our gitlab
pipeline and relied on the output to inform the developer what went wrong.
We solved it like this:

{{{
test:
script:
- ...
- pipenv run python manage.py makemigrations --check || echo "Your
models have changes that are not yet reflected in a migration. Run
'manage.py makemigrations' to make new migrations, and then re-run
'manage.py migrate' to apply them." && false
- ...
}}}

But I guess it's a bit too specific for adding to the documentation.

--
Ticket URL: <https://code.djangoproject.com/ticket/34632#comment:5>

Reply all
Reply to author
Forward
0 new messages