feat: auto-add agent_config columns to DB

This commit is contained in:
ymq 2026-08-10 17:01:18 +08:00
parent c249e872fb
commit ea9b0f2ae4

View File

@ -617,7 +617,7 @@ def load_pipeline_service():
add_startup(_pm_poller)
# v2 DDL auto-init: create pipeline_user_memory table at startup
# v2 DDL auto-init: create tables and columns at startup
async def _init_v2_tables(app):
from sqlor.dbpools import DBPools as _DBP2
from appPublic.log import debug as _debug
@ -635,8 +635,19 @@ def load_pipeline_service():
"KEY idx_category_priority (category, priority)"
") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4", {})
_debug("pipeline_user_memory table ready")
# agent_config columns
try:
await sor.sqlExe("ALTER TABLE pipelines ADD COLUMN agent_config text", {})
_debug("pipelines.agent_config column added")
except Exception:
pass
try:
await sor.sqlExe("ALTER TABLE sd_org_settings ADD COLUMN agent_config text", {})
_debug("sd_org_settings.agent_config column added")
except Exception:
pass
except Exception as e:
_debug(f"pipeline_user_memory init: {e}")
_debug(f"v2 DDL init: {e}")
add_startup(_init_v2_tables)