бд в папке
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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("""
|
||||
|
||||
Reference in New Issue
Block a user