fix(ai-ops): 修正 _init_autoheal_tables 建表順序 (Playbook 先於 Incident FK)
All checks were successful
CD Pipeline / deploy (push) Successful in 1m23s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m23s
incidents.playbook_id → FK → playbooks.id 建表必須先 Playbook 再 Incident,否則 psycopg2 報 UndefinedTable Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -127,7 +127,7 @@ class DatabaseManager:
|
||||
inspector = sa_inspect(self.engine)
|
||||
existing_tables = inspector.get_table_names()
|
||||
|
||||
for model in [Incident, Playbook, HealLog]:
|
||||
for model in [Playbook, Incident, HealLog]:
|
||||
if model.__tablename__ not in existing_tables:
|
||||
model.__table__.create(self.engine, checkfirst=True)
|
||||
sys_log.info(f"[Database] ✅ 建立 AIOps 表: {model.__tablename__}")
|
||||
|
||||
Reference in New Issue
Block a user