Refactor path management and configuration utilities

This commit is contained in:
2026-05-06 06:13:31 +02:00
parent 0f0a82b798
commit ef1ecd463b
3 changed files with 100 additions and 5 deletions

View File

@@ -1,7 +1,9 @@
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, DeclarativeBase
from sqlalchemy import text
from sqlalchemy import create_engine
from sqlalchemy.orm import DeclarativeBase, sessionmaker
from .paths import database_path, sqlite_database_url
"""
Database utilities and configuration. This module defines the SQLAlchemy
@@ -15,7 +17,8 @@ only run once on startup. It is safe to call repeatedly: when a column
already exists, the function will simply no-op.
"""
DATABASE_URL = "sqlite:///./backend/app.db"
DATABASE_PATH = database_path()
DATABASE_URL = sqlite_database_url(DATABASE_PATH)
engine = create_engine(
DATABASE_URL, connect_args={"check_same_thread": False}