Skip to content

Commit

Permalink
use config.DB_FPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
0dm committed Jun 3, 2023
1 parent b728c98 commit b7ed43e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions openadapt/scripts/reset_db.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import os
from subprocess import run, PIPE
from openadapt.config import getenv_fallback
from openadapt import config


def reset_db():
"""
The function clears the database by removing the database file and running a
database migration using Alembic.
"""
db = getenv_fallback("DB_FNAME")
if os.path.exists(db):
os.remove(db)
if os.path.exists(config.DB_FPATH):
os.remove(config.DB_FPATH)

# Prevents duplicate logging of config values by piping stderr and filtering the output.
result = run(["alembic", "upgrade", "head"], stderr=PIPE, text=True)
Expand Down

0 comments on commit b7ed43e

Please sign in to comment.