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

Function _run_migrate

tortoise/cli/cli.py:510–544  ·  view source on GitHub ↗
(
    ctx: CLIContext,
    app_label: str | None,
    migration: str | None,
    *,
    fake: bool,
    dry_run: bool,
    target_override: str | None = None,
    direction: str = "both",
)

Source from the content-addressed store, hash-verified

508
509
510async 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
547async def migrate(

Callers 3

migrateFunction · 0.85
upgradeFunction · 0.85
downgradeFunction · 0.85

Calls 2

_load_configFunction · 0.85
tortoise_cli_contextFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…