creating tables

This commit is contained in:
Doctor Delpy committed 2025-12-11 19:12:05 +03:00
1 parent b0055e174f
commit 1def6e3512
3 files changed
+31 -33

No files matched your search

-16
View File
@@ -32,22 +32,6 @@ def _init_seed_via_db() -> bytes:
engine = create_engine(DATABASE_URL, pool_pre_ping=True)
role = os.getenv("NODE_ROLE", "worker").lower()
# Best-effort: ensure service_config table exists before waiting on it.
# This complements the synchronous init in app.__main__ and protects
# against ordering issues where _secrets is imported before that init runs.
try:
from sqlalchemy.exc import SQLAlchemyError
with engine.begin() as conn:
inspector = inspect(conn)
if not inspector.has_table('service_config'):
ServiceConfigValue.__table__.create(bind=conn, checkfirst=True)
except SQLAlchemyError as exc:
make_log("HotWallet", f"Failed to ensure service_config table: {exc}", level="error")
except Exception:
# Avoid failing hard here; the fallback waiter below may still succeed
pass
def db_ready(conn) -> bool:
try:
inspector = inspect(conn)
+1
View File
@@ -61,6 +61,7 @@ class DHTStore:
try:
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from app.core._config import DATABASE_URL
from app.core.models.dht import DHTRecordRow