Opened 3 years ago

Closed 3 years ago

#33246 closed Cleanup/optimization (fixed)

--squashed-name can overwrite existing migration files

Reported by: AndrewN Owned by: AndrewN
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

squashmigrations --squashed-name initial myapp 0002 will overwrite 0001_initial.py. If that migration has already been applied anywhere, the code and the database will be in an inconsistent state. Furthermore, the 0002_... migration likely depends on 0001_initial, so the new replaces = …0002… line added to 0001_initial.py introduces a CircularDependencyError.

squashmigrations should exit with an error instead of overwriting existing migration files.

Change History (5)

comment:2 by Mariusz Felisiak, 3 years ago

Owner: changed from nobody to AndrewN
Status: newassigned
Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

comment:3 by Mariusz Felisiak, 3 years ago

Patch needs improvement: set

comment:4 by Mariusz Felisiak, 3 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:5 by GitHub <noreply@…>, 3 years ago

Resolution: fixed
Status: assignedclosed

In 9e6d6316:

Fixed #33246 -- Made squashmigrations raise CommandError when squashed_name already exists.

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