Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25231 closed Bug (fixed)

Incomplete Fix for #24628 - Squashed Migration Still Not Marked as Applied

Reported by: Mark Lavin Owned by: nobody
Component: Migrations Version: 1.8
Severity: Normal Keywords:
Cc: Simon Charette 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

I'm still seeing this behavior in 1.8.3 so I believe that this fix is incomplete. The problem with the original fix is that it relies on the executor.migrate method being called. While that is done by the tests, it isn't when following the workflow described in the docs. When you call the migrate management command, it first checks the migration plan to see if any migrations need to be run. Since the migration plan sees the replacement migration as already applied there is no plan (assuming there are no other unapplied migrations) and the executor.migrate is never called. In this case the replacement migration is never recorded as applied. Then when the old migrations are removed and the replaces attribute is removed, the migrate command attempts to run the squashed migration which fails since the tables, etc already exist.

Change History (5)

comment:1 by Mark Lavin, 9 years ago

The easiest work-around is to use the --fake-initial option when applying the squashed migration. This assumes that you are squashing the migrations down to a single initial migration.

Last edited 9 years ago by Mark Lavin (previous) (diff)

comment:2 by Mark Lavin, 9 years ago

Has patch: set
Version 0, edited 9 years ago by Mark Lavin (next)

comment:3 by Simon Charette, 9 years ago

Cc: Simon Charette added
Triage Stage: UnreviewedReady for checkin
Type: UncategorizedBug

comment:4 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: newclosed

In 69db1c7:

Fixed #25231 -- Added recording of squashed migrations in the migrate command.

Ensured squashed migrations are recorded as applied when the
migrate command is run and all of the original migrations
have been previously applied.

comment:5 by Tim Graham <timograham@…>, 9 years ago

In ac46eb7:

[1.8.x] Fixed #25231 -- Added recording of squashed migrations in the migrate command.

Ensured squashed migrations are recorded as applied when the
migrate command is run and all of the original migrations
have been previously applied.

Backport of 69db1c745506bf63026def25d6854755179feaa8 from master

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