Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/basic_memory/cli/commands/db.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
"""Database management commands."""

import asyncio

import typer
from loguru import logger

from basic_memory.alembic import migrations
from basic_memory import db
from basic_memory.cli.app import app
from basic_memory.config import config


@app.command()
Expand All @@ -14,7 +17,17 @@ def reset(
"""Reset database (drop all tables and recreate)."""
if typer.confirm("This will delete all data in your db. Are you sure?"):
logger.info("Resetting database...")
migrations.reset_database()
# Get database path
db_path = config.database_path

# Delete the database file if it exists
if db_path.exists():
db_path.unlink()
logger.info(f"Database file deleted: {db_path}")

# Create a new empty database
asyncio.run(db.run_migrations(config))
logger.info("Database reset complete")

if reindex:
# Import and run sync
Expand Down
19 changes: 10 additions & 9 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading