MCPcopy
hub / github.com/tortoise/tortoise-orm / _dedupe_plan

Method _dedupe_plan

tortoise/migrations/executor.py:342–353  ·  view source on GitHub ↗
(self, plan: list[PlanStep])

Source from the content-addressed store, hash-verified

340 return plan
341
342 def _dedupe_plan(self, plan: list[PlanStep]) -> list[PlanStep]:
343 deduped: list[PlanStep] = []
344 seen: dict[MigrationKey, bool] = {}
345 for step in plan:
346 key = MigrationKey(app_label=step.migration.app_label, name=step.migration.name)
347 if key in seen:
348 if seen[key] != step.backward:
349 raise ValueError(f"Conflicting migration directions for {key}")
350 continue
351 seen[key] = step.backward
352 deduped.append(step)
353 return deduped
354
355 @staticmethod
356 def _validate_plan_direction(plan: list[PlanStep], direction: str) -> None:

Callers 1

_migration_planMethod · 0.95

Calls 1

MigrationKeyClass · 0.90

Tested by

no test coverage detected