File tree Expand file tree Collapse file tree 2 files changed +24
-10
lines changed
src/basic_memory/cli/commands Expand file tree Collapse file tree 2 files changed +24
-10
lines changed Original file line number Diff line number Diff line change 11"""Database management commands."""
22
3+ import asyncio
4+
35import typer
46from loguru import logger
57
6- from basic_memory . alembic import migrations
8+ from basic_memory import db
79from 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
You can’t perform that action at this time.
0 commit comments