Initial MinerOps working checkpoint

This commit is contained in:
MinerOps Admin committed 2026-07-22 20:56:41 +00:00
commit 4c854374e0
103 files changed
+2400932

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import DeclarativeBase, sessionmaker
from app.config import settings
def build_database_url() -> str:
return (
f"postgresql+psycopg://{settings.postgres_user}:"
f"{settings.postgres_password}@{settings.postgres_host}:"
f"{settings.postgres_port}/{settings.postgres_db}"
)
DATABASE_URL = build_database_url()
engine = create_engine(DATABASE_URL, pool_pre_ping=True)
SessionLocal = sessionmaker(
autocommit=False,
autoflush=False,
bind=engine,
)
class Base(DeclarativeBase):
pass
def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()