| 12345678910111213141516171819202122232425262728293031323334 |
- # -*- coding: utf-8 -*-
- """P4-16 Apply ApprovalFlowNotifyLog DDL to shared dev DB."""
- import pymysql
- import re
- from pathlib import Path
- ddl_path = Path(r"d:/Projects/Ai-DOP/SourceCode/ZZYDOP/doc/migrations/2026-04-16_approval_flow_notify_log.sql")
- raw = ddl_path.read_text(encoding='utf-8')
- lines = [ln for ln in raw.splitlines() if not ln.strip().startswith('--')]
- clean = '\n'.join(lines)
- statements = [s.strip() for s in clean.split(';') if s.strip()]
- print(f"parsed {len(statements)} statements")
- conn = pymysql.connect(
- host='123.60.180.165', port=3306,
- user='aidopremote', password='1234567890aiDOP#',
- database='aidopdev', charset='utf8mb4', autocommit=True,
- )
- try:
- with conn.cursor() as cur:
- for st in statements:
- print(f"--> executing ({len(st)} chars): {st[:80]}...")
- cur.execute(st)
- print(" done")
- cur.execute("SHOW TABLES LIKE 'ApprovalFlowNotifyLog'")
- rows = cur.fetchall()
- print(f"Table check: {rows}")
- if rows:
- cur.execute("DESC ApprovalFlowNotifyLog")
- for r in cur.fetchall():
- print(r)
- finally:
- conn.close()
|