| 12345678910111213141516171819202122232425262728293031 |
- """Apply UpdateScripts/1.0.263.sql to aidopdev."""
- from pathlib import Path
- from _db import get_conn
- SQL = Path(__file__).resolve().parents[4] / "server/Admin.NET.Web.Entry/UpdateScripts/1.0.263.sql"
- def main():
- body = "\n".join(ln for ln in SQL.read_text(encoding="utf-8").splitlines() if not ln.strip().startswith("--"))
- conn = get_conn()
- try:
- with conn.cursor() as cur:
- cur.execute(body)
- print("affected", cur.rowcount)
- cur.execute("SELECT COUNT(*) AS c FROM mdp_entity WHERE entity_code LIKE %s", ("%\\_API",))
- print("api_cnt", cur.fetchone()["c"])
- cur.execute(
- """
- SELECT COUNT(*) AS c FROM mdp_entity e
- WHERE e.entity_code NOT LIKE %s AND IFNULL(e.target_table_name,'')<>''
- AND NOT EXISTS (SELECT 1 FROM mdp_entity a WHERE a.entity_code=CONCAT(e.entity_code,'_API'))
- """,
- ("%\\_API",),
- )
- print("still_missing_with_stg", cur.fetchone()["c"])
- finally:
- conn.close()
- if __name__ == "__main__":
- main()
|