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

Function history

tortoise/cli/cli.py:603–616  ·  view source on GitHub ↗
(ctx: CLIContext, app_labels: tuple[str, ...])

Source from the content-addressed store, hash-verified

601
602
603async def history(ctx: CLIContext, app_labels: tuple[str, ...]) -> None:
604 tortoise_config = _load_config(ctx)
605 apps_config = _select_apps(tortoise_config, app_labels or None)
606 apps_dict = {label: app.to_dict() for label, app in apps_config.items()}
607 apps_by_connection = _group_apps_by_connection(apps_dict)
608
609 config_dict = tortoise_config.to_dict()
610 config_dict["apps"] = apps_dict
611
612 async with tortoise_cli_context(config_dict):
613 for connection_name, subset in apps_by_connection.items():
614 recorder = MigrationRecorder(get_connection(connection_name))
615 applied = await recorder.applied_migrations()
616 _emit_history(applied, connection_name, subset)
617
618
619async def heads(ctx: CLIContext, app_labels: tuple[str, ...]) -> None:

Callers 1

_run_historyFunction · 0.85

Calls 10

applied_migrationsMethod · 0.95
MigrationRecorderClass · 0.90
get_connectionFunction · 0.90
_load_configFunction · 0.85
_select_appsFunction · 0.85
tortoise_cli_contextFunction · 0.85
_emit_historyFunction · 0.85
itemsMethod · 0.80
to_dictMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…