diff --git a/makefile b/makefile index fc52c09d..5619a1b7 100644 --- a/makefile +++ b/makefile @@ -80,6 +80,9 @@ clean: @rm -rf data/alembic/ @rm -rf data/*.db +hard_reset: + @poetry run python src/main.py --hard_reset_db + install: @poetry install --with dev diff --git a/src/program/db/db_functions.py b/src/program/db/db_functions.py index b5ddf33f..5f8c43d3 100644 --- a/src/program/db/db_functions.py +++ b/src/program/db/db_functions.py @@ -12,7 +12,7 @@ from utils.logger import logger from utils import alembic_dir -from .db import db +from .db import db, alembic def _ensure_item_exists_in_db(item: MediaItem) -> bool: @@ -143,6 +143,8 @@ def hard_reset_database(): logger.debug("Removing Alembic Directory") shutil.rmtree(alembic_dir, ignore_errors=True) os.makedirs(alembic_dir, exist_ok=True) + alembic.init(alembic_dir) + logger.debug("Alembic reinitialized") logger.debug("Hard Reset Complete")