(
self,
target: MigrationTarget,
applied: set[MigrationKey],
graph: MigrationGraph,
*,
include_target: bool = False,
)
| 319 | return plan |
| 320 | |
| 321 | def _backward_plan( |
| 322 | self, |
| 323 | target: MigrationTarget, |
| 324 | applied: set[MigrationKey], |
| 325 | graph: MigrationGraph, |
| 326 | *, |
| 327 | include_target: bool = False, |
| 328 | ) -> list[PlanStep]: |
| 329 | plan: list[PlanStep] = [] |
| 330 | target_key = MigrationKey(app_label=target.app_label, name=target.name) |
| 331 | for key in graph.backwards_plan(target_key): |
| 332 | if key not in applied: |
| 333 | continue |
| 334 | if not include_target and key == target_key: |
| 335 | continue |
| 336 | migration = graph.nodes[key] |
| 337 | if not isinstance(migration, Migration): |
| 338 | raise ValueError(f"Missing migration for {key}") |
| 339 | plan.append(PlanStep(migration=migration, backward=True)) |
| 340 | return plan |
| 341 | |
| 342 | def _dedupe_plan(self, plan: list[PlanStep]) -> list[PlanStep]: |
| 343 | deduped: list[PlanStep] = [] |
no test coverage detected