File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -1553,6 +1553,47 @@ def cli_deploy_cloud_run(
15531553 click .secho (f"Deploy failed: { e } " , fg = "red" , err = True )
15541554
15551555
1556+ @main .group ()
1557+ def migrate ():
1558+ """ADK migration commands."""
1559+ pass
1560+
1561+
1562+ @migrate .command ("session" , cls = HelpfulCommand )
1563+ @click .option (
1564+ "--source_db_url" ,
1565+ required = True ,
1566+ help = (
1567+ "SQLAlchemy URL of source database in database session service, e.g."
1568+ " sqlite:///source.db."
1569+ ),
1570+ )
1571+ @click .option (
1572+ "--dest_db_url" ,
1573+ required = True ,
1574+ help = (
1575+ "SQLAlchemy URL of destination database in database session service,"
1576+ " e.g. sqlite:///dest.db."
1577+ ),
1578+ )
1579+ @click .option (
1580+ "--log_level" ,
1581+ type = LOG_LEVELS ,
1582+ default = "INFO" ,
1583+ help = "Optional. Set the logging level" ,
1584+ )
1585+ def cli_migrate_session (
1586+ * , source_db_url : str , dest_db_url : str , log_level : str
1587+ ):
1588+ """Migrates a session database to the latest schema version."""
1589+ logs .setup_adk_logger (getattr (logging , log_level .upper ()))
1590+ try :
1591+ migration_runner .upgrade (source_db_url , dest_db_url )
1592+ click .secho ("Migration check and upgrade process finished." , fg = "green" )
1593+ except Exception as e :
1594+ click .secho (f"Migration failed: { e } " , fg = "red" , err = True )
1595+
1596+
15561597@deploy .command ("agent_engine" )
15571598@click .option (
15581599 "--api_key" ,
You can’t perform that action at this time.
0 commit comments