(
ctx: CLIContext,
app_label: str | None,
migration: str | None,
*,
fake: bool,
dry_run: bool,
target_override: str | None = None,
direction: str = "both",
)
| 508 | |
| 509 | |
| 510 | async def _run_migrate( |
| 511 | ctx: CLIContext, |
| 512 | app_label: str | None, |
| 513 | migration: str | None, |
| 514 | *, |
| 515 | fake: bool, |
| 516 | dry_run: bool, |
| 517 | target_override: str | None = None, |
| 518 | direction: str = "both", |
| 519 | ) -> None: |
| 520 | if app_label and not migration and "." in app_label: |
| 521 | app_label, migration = app_label.split(".", 1) |
| 522 | |
| 523 | config = _load_config(ctx) |
| 524 | |
| 525 | target = target_override |
| 526 | if target is None: |
| 527 | if app_label and not migration: |
| 528 | target = f"{app_label}.__latest__" |
| 529 | elif migration: |
| 530 | if not app_label: |
| 531 | raise utils.CLIUsageError("MIGRATION requires APP_LABEL") |
| 532 | target = f"{app_label}.{migration}" |
| 533 | |
| 534 | async with tortoise_cli_context(config): |
| 535 | await migrate_api( |
| 536 | config=config, |
| 537 | app_labels=None, |
| 538 | target=target, |
| 539 | fake=fake, |
| 540 | dry_run=dry_run, |
| 541 | direction=direction, |
| 542 | reporter=_emit_migration_plan, |
| 543 | progress=_progress_reporter, |
| 544 | ) |
| 545 | |
| 546 | |
| 547 | async def migrate( |
no test coverage detected
searching dependent graphs…