General idea:
1. Add all normal migrations
1. Add all their dependencies (create dummy nodes for non-existing
squashed migrations)
1. Replace the nodes in the graph when they have been replaces with
suitable squashed migrations and update the dependencies accordingly
1. Ensure there are no dummy nodes left in the graph and the graph is
consistent.
--
Ticket URL: <https://code.djangoproject.com/ticket/26292>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by jarekwg):
While working on this, I started toying around with the idea of building
the migration graph in a more complex way where it's aware of applied/non-
applied and replacing/non-replacing migrations. Something along the lines
of a directional graph with coloured nodes (denoting applied/non-applied)
and coloured edges (denoting dependency/replaces).
This would still spawn dummy nodes as it builds the graph, but once
finished, an extra function could then be run over the graph - something
like `simplify` or `resolve` - where the graph would resolve all the
replacing migrations internally, simplifying itself back down to the form
it has currently.
It's not the path I'm taking currently, as I'm trying to avoid giving the
graph too much knowledge of stuff that's only needed for its
initialisation. Seems to belong more to the loader. But just thought I'd
leave this idea here as food for thought.
--
Ticket URL: <https://code.djangoproject.com/ticket/26292#comment:1>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/26292#comment:2>
* needs_better_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/26292#comment:3>
* needs_better_patch: 1 => 0
Comment:
I'll give this PR a small benchmark test later this week, but would
generally love to see this in 1.10. There are a couple of optimization
options Jarek and I have in mind but they should be fine to be submitted
when alpha was cut, IMO.
--
Ticket URL: <https://code.djangoproject.com/ticket/26292#comment:4>
* stage: Accepted => Ready for checkin
Comment:
Optimization is tracked in #26407.
--
Ticket URL: <https://code.djangoproject.com/ticket/26292#comment:5>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"509379a161d179f9e973fbaf6393e879531756f6" 509379a1]:
{{{
#!CommitTicketReference repository=""
revision="509379a161d179f9e973fbaf6393e879531756f6"
Fixed #25945, #26292 -- Refactored MigrationLoader.build_graph()
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/26292#comment:6>