cd636ff1c3
Co-authored-by: Cursor <cursoragent@cursor.com>
32 lines
801 B
Python
32 lines
801 B
Python
#!/usr/bin/env python3
|
|
"""Ensure account_risk_state exists (PostgreSQL hotfix)."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv(ROOT / ".env")
|
|
|
|
from db_conn import connect_db, database_label # noqa: E402
|
|
from risk.account_risk_lib import ( # noqa: E402
|
|
_SCHEMA_READY,
|
|
ensure_account_risk_schema,
|
|
)
|
|
|
|
import risk.account_risk_lib as risk_mod
|
|
|
|
risk_mod._SCHEMA_READY = False
|
|
conn = connect_db()
|
|
try:
|
|
ensure_account_risk_schema(conn)
|
|
row = conn.execute("SELECT * FROM account_risk_state WHERE id=1").fetchone()
|
|
print("OK", database_label(), "row=", dict(row) if row else None)
|
|
finally:
|
|
conn.close()
|