INNER CODE UNIT · Python
edit_revision
litestar-org/advanced-alchemy · advanced_alchemy/cli.py:272
def edit_revision(bind_key: Optional[str], revision: str) -> None: # pyright: ignore[reportUnusedFunction]
"""Edit revision script with system editor."""
from advanced_alchemy.alembic.commands import AlembicCommands
ctx = cast("click.Context", click.get_current_context())
console.rule(f"[yellow]Opening revision {revision} in editor[/]", align="left")
sqlalchemy_config = get_config_by_bind_key(ctx, bind_key)
alembic_commands = AlembicCommands(sqlalchemy_config=sqlalchemy_config)
alembic_commands.edit(revision=revision)
@database_group.command(
name="ensure-version",
help="Create the alembic version table if it doesn't exist",
)
@bind_key_option
@click.option("--sql", is_flag=True, default=False, help="Generate SQL output instead of executing")
def ensure_version_table(bind_key: Optional[str], sql: bool) -> None: # pyright: ignore[reportUnusedFunction]
"""Ensure alembic version table exists."""