mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
chore: Add back adk migrate session CLI
It was accidentally deleted in a previous PR. Closes #4107. Co-authored-by: Liang Wu <wuliang@google.com> PiperOrigin-RevId: 854339442
This commit is contained in:
committed by
Copybara-Service
parent
6b241f5ef2
commit
8fb2be216f
@@ -1553,6 +1553,47 @@ def cli_deploy_cloud_run(
|
||||
click.secho(f"Deploy failed: {e}", fg="red", err=True)
|
||||
|
||||
|
||||
@main.group()
|
||||
def migrate():
|
||||
"""ADK migration commands."""
|
||||
pass
|
||||
|
||||
|
||||
@migrate.command("session", cls=HelpfulCommand)
|
||||
@click.option(
|
||||
"--source_db_url",
|
||||
required=True,
|
||||
help=(
|
||||
"SQLAlchemy URL of source database in database session service, e.g."
|
||||
" sqlite:///source.db."
|
||||
),
|
||||
)
|
||||
@click.option(
|
||||
"--dest_db_url",
|
||||
required=True,
|
||||
help=(
|
||||
"SQLAlchemy URL of destination database in database session service,"
|
||||
" e.g. sqlite:///dest.db."
|
||||
),
|
||||
)
|
||||
@click.option(
|
||||
"--log_level",
|
||||
type=LOG_LEVELS,
|
||||
default="INFO",
|
||||
help="Optional. Set the logging level",
|
||||
)
|
||||
def cli_migrate_session(
|
||||
*, source_db_url: str, dest_db_url: str, log_level: str
|
||||
):
|
||||
"""Migrates a session database to the latest schema version."""
|
||||
logs.setup_adk_logger(getattr(logging, log_level.upper()))
|
||||
try:
|
||||
migration_runner.upgrade(source_db_url, dest_db_url)
|
||||
click.secho("Migration check and upgrade process finished.", fg="green")
|
||||
except Exception as e:
|
||||
click.secho(f"Migration failed: {e}", fg="red", err=True)
|
||||
|
||||
|
||||
@deploy.command("agent_engine")
|
||||
@click.option(
|
||||
"--api_key",
|
||||
|
||||
Reference in New Issue
Block a user