(
ctx: CLIContext,
app_label: str | None,
migration: str | None,
fake: bool,
dry_run: bool,
)
| 572 | |
| 573 | |
| 574 | async def downgrade( |
| 575 | ctx: CLIContext, |
| 576 | app_label: str | None, |
| 577 | migration: str | None, |
| 578 | fake: bool, |
| 579 | dry_run: bool, |
| 580 | ) -> None: |
| 581 | if not app_label: |
| 582 | config = _load_config(ctx) |
| 583 | labels = sorted(config.apps) if config.apps else [] |
| 584 | available = ", ".join(labels) if labels else "(none)" |
| 585 | raise utils.CLIUsageError(f"app_label is required. Available app labels: {available}") |
| 586 | if not migration and "." in app_label: |
| 587 | app_label, migration = app_label.split(".", 1) |
| 588 | if migration: |
| 589 | target = f"{app_label}.{migration}" |
| 590 | else: |
| 591 | target = f"{app_label}.__first__" |
| 592 | await _run_migrate( |
| 593 | ctx, |
| 594 | app_label, |
| 595 | migration, |
| 596 | fake=fake, |
| 597 | dry_run=dry_run, |
| 598 | target_override=target, |
| 599 | direction="backward", |
| 600 | ) |
| 601 | |
| 602 | |
| 603 | async def history(ctx: CLIContext, app_labels: tuple[str, ...]) -> None: |
no test coverage detected
searching dependent graphs…