бд в папке

This commit is contained in:
2026-02-03 13:05:00 +03:00
parent 72fdde3eb7
commit 05c4773a50
6 changed files with 9 additions and 5 deletions

View File

@@ -22,4 +22,5 @@ BASE_DIR: Path = Path(__file__).parent.parent
DATA_DIR: Path = BASE_DIR / "data"
DATA_PARTIAL_DIR: Path = BASE_DIR / "data_partial"
SCENARIOS_DIR: Path = BASE_DIR / "scenarios"
DB_PATH: Path = BASE_DIR / "bot.db"
DB_DIR: Path = BASE_DIR / "db"
DB_PATH: Path = DB_DIR / "bot.db"

View File

@@ -91,7 +91,10 @@ def get_connection() -> Generator[sqlite3.Connection, None, None]:
def init_db() -> None:
"""Инициализирует схему базы данных."""
from src.config import DB_DIR
logger.info("Инициализация базы данных...")
DB_DIR.mkdir(parents=True, exist_ok=True)
with get_connection() as conn:
conn.executescript("""