Opened 21 months ago

Closed 21 months ago

Last modified 5 months ago

#34051 closed Cleanup/optimization (fixed)

makemigrations --check generating migrations is inconsistent with other uses of --check

Reported by: Jacob Walls Owned by: Jacob Walls
Component: Migrations Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

To script a check for missing migrations but without actually intending to create the migrations, it is necessary to use both --check and --dry-run, which is inconsistent with migrate --check and optimizemigration --check, which just exit (after possibly logging a bit).

I'm suggesting that makemigrations --check should just exit without making migrations.

The choice to write the migrations anyway was not discussed AFAICT on ticket:25604 or https://groups.google.com/g/django-developers/c/zczdY6c9KSg/m/ZXCXQsGDDAAJ.

Noticed when reading PR to adjust the documentation of migrate --check. I think the current documentation is silent on this question.

Change History (8)

comment:1 by Claude Paroz, 21 months ago

Triage Stage: UnreviewedAccepted

I think this makes sense.

comment:2 by Jacob Walls, 21 months ago

Has patch: set
Owner: changed from nobody to Jacob Walls
Status: newassigned

comment:3 by Mariusz Felisiak, 21 months ago

Needs documentation: set
Patch needs improvement: set

comment:4 by Jacob Walls, 21 months ago

Needs documentation: unset
Patch needs improvement: unset

comment:5 by Mariusz Felisiak, 21 months ago

Triage Stage: AcceptedReady for checkin

comment:6 by Mariusz Felisiak <felisiak.mariusz@…>, 21 months ago

Resolution: fixed
Status: assignedclosed

In 80d38de5:

Fixed #34051 -- Made makemigrations --check exit before making migrations.

comment:7 by Daniel Hahler, 5 months ago

I was using --check --dry-run to see missing migrations on CI already, which now becomes silent.

Would it make sense to have migrations still being written/printed in case --dry-run is used.

Or is there another option to get the desired behavior on CI?

(You could use --check first an in case of exiting with 1 use --dry-run alone, but I think the old behavior was good).

I am using also -v3 to make it very verbose - maybe that could be taken into consideration also.

comment:8 by Daniel Hahler, 5 months ago

Oh, addressed/fixed in #34457 already.

Note: See TracTickets for help on using tickets.
Back to Top