MCPcopy Index your code
hub / github.com/tortoise/tortoise-orm / downgrade

Function downgrade

tortoise/cli/cli.py:574–600  ·  view source on GitHub ↗
(
    ctx: CLIContext,
    app_label: str | None,
    migration: str | None,
    fake: bool,
    dry_run: bool,
)

Source from the content-addressed store, hash-verified

572
573
574async 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
603async def history(ctx: CLIContext, app_labels: tuple[str, ...]) -> None:

Callers 1

_run_downgradeFunction · 0.85

Calls 2

_load_configFunction · 0.85
_run_migrateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…