Skip to content

Commit 0743ade

Browse files
authored
fix: just delete db for reset db instead of using migrations. (#65)
Signed-off-by: phernandez <paul@basicmachines.co>
1 parent f1c9570 commit 0743ade

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

src/basic_memory/cli/commands/db.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
"""Database management commands."""
22

3+
import asyncio
4+
35
import typer
46
from loguru import logger
57

6-
from basic_memory.alembic import migrations
8+
from basic_memory import db
79
from basic_memory.cli.app import app
10+
from basic_memory.config import config
811

912

1013
@app.command()
@@ -14,7 +17,17 @@ def reset(
1417
"""Reset database (drop all tables and recreate)."""
1518
if typer.confirm("This will delete all data in your db. Are you sure?"):
1619
logger.info("Resetting database...")
17-
migrations.reset_database()
20+
# Get database path
21+
db_path = config.database_path
22+
23+
# Delete the database file if it exists
24+
if db_path.exists():
25+
db_path.unlink()
26+
logger.info(f"Database file deleted: {db_path}")
27+
28+
# Create a new empty database
29+
asyncio.run(db.run_migrations(config))
30+
logger.info("Database reset complete")
1831

1932
if reindex:
2033
# Import and run sync

uv.lock

Lines changed: 9 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)