Skip to content

Commit

Permalink
fix: add alembic reinit to hard reset
Browse files Browse the repository at this point in the history
  • Loading branch information
dreulavelle committed Jul 27, 2024
1 parent e3366a6 commit 91ba58b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion src/program/db/db_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit 91ba58b

Please sign in to comment.