Opened 20 months ago

Closed 12 months ago

Last modified 12 months ago

#34457 closed Bug (fixed)

makemigrations --check no longer prints the changes

Reported by: David Sanders Owned by: Adam Johnson
Component: Migrations Version: 4.2
Severity: Release blocker Keywords:
Cc: Claude Paroz, Jacob Walls 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

As a result of #34051 the --check flag on makemigrations simply exits 1 without writing any changes.

This makes sense as it's consistent with other uses of --check.

However one consequence of this change is that my CI server no longer prints the changes it thinks I need to make – and this makes the situations where the local dev & CI are different, harder to debug.

I'd like to propose reverting this change and instead forcing --dry-run to be set if --check is supplied. This way makemigrations goes through the motions of what it needs to write, outputting those changes to the log but the dry flag prevents any migrations from being written.

Change History (19)

comment:2 by Mariusz Felisiak, 20 months ago

Resolution: wontfix
Status: newclosed
Type: UncategorizedCleanup/optimization

Thanks for the ticket, however I don't think it's worth the inconsistency. You could re-run makemigrations when makemigrations --check exists with 1, e.g.

RESULT=`makemigrations --check`
if [ "$RESULT" -gt 0 ]; then
    makemigrations --dry-run
fi;
exit $RESULT

comment:3 by Mariusz Felisiak, 20 months ago

Cc: Claude Paroz Jacob Walls added

comment:4 by Jacob Walls, 20 months ago

Or instead of a bash script, use something like if: failure() in your CI pipeline. Forcing --dry-run to once again be provided when --check is provided goes against the original motivation for the change: it's unintuitive (to me) that for --check you would need to guard against files being written your tree and therefore even know about the --dry-run option.

comment:5 by David Sanders, 20 months ago

Forcing --dry-run to once again be provided when --check is provided goes against the original motivation for the change

By forcing I mean makemigrations does the forcing… see the PR for what I mean ;)

Last edited 20 months ago by David Sanders (previous) (diff)

comment:6 by Jacob Walls, 13 months ago

Triage Stage: UnreviewedAccepted

Accepting based on forum discussion.

comment:7 by Jacob Walls, 13 months ago

Resolution: wontfix
Status: closednew

comment:8 by Mariusz Felisiak, 13 months ago

Has patch: unset

comment:9 by Adam Johnson, 12 months ago

Severity: NormalRelease blocker
Type: Cleanup/optimizationBug

Marking as a release blocker because I consider it a regression, as discussed on the forum.

comment:10 by Adam Johnson, 12 months ago

Has patch: set

comment:11 by Jacob Walls, 12 months ago

Owner: changed from nobody to Adam Johnson
Status: newassigned
Triage Stage: AcceptedReady for checkin

comment:12 by Natalia Bidart, 12 months ago

Patch needs improvement: set

comment:13 by Adam Johnson, 12 months ago

Patch needs improvement: unset

comment:14 by Natalia Bidart, 12 months ago

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

comment:15 by Adam Johnson, 12 months ago

Patch needs improvement: unset

comment:16 by Natalia Bidart, 12 months ago

Triage Stage: AcceptedReady for checkin

comment:17 by Natalia <124304+nessita@…>, 12 months ago

Resolution: fixed
Status: assignedclosed

In f7389c4:

Fixed #34457 -- Restored output for makemigrations --check.

Co-authored-by: David Sanders <shang.xiao.sanders@…>
Co-authored-by: Natalia <124304+nessita@…>

comment:18 by Natalia <124304+nessita@…>, 12 months ago

In 8eba6ef:

[5.0.x] Fixed #34457 -- Restored output for makemigrations --check.

Co-authored-by: David Sanders <shang.xiao.sanders@…>
Co-authored-by: Natalia <124304+nessita@…>

Backport of f7389c4b07ceeb036436e065898e411b247bca78 from main

comment:19 by Natalia <124304+nessita@…>, 12 months ago

In 90c3d71d:

[4.2.x] Fixed #34457 -- Restored output for makemigrations --check.

Co-authored-by: David Sanders <shang.xiao.sanders@…>
Co-authored-by: Natalia <124304+nessita@…>

Backport of f7389c4b07ceeb036436e065898e411b247bca78 from main

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