mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
6a4bd54646
fix: drop search_index table on db reindex fix: ai_resource_guide.md path chore: remove logfire Signed-off-by: phernandez <paul@basicmachines.co>
25 lines
754 B
Python
25 lines
754 B
Python
"""Database management commands."""
|
|
|
|
import typer
|
|
from loguru import logger
|
|
|
|
from basic_memory.alembic import migrations
|
|
from basic_memory.cli.app import app
|
|
|
|
|
|
@app.command()
|
|
def reset(
|
|
reindex: bool = typer.Option(False, "--reindex", help="Rebuild db index from filesystem"),
|
|
): # pragma: no cover
|
|
"""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()
|
|
|
|
if reindex:
|
|
# Import and run sync
|
|
from basic_memory.cli.commands.sync import sync
|
|
|
|
logger.info("Rebuilding search index from filesystem...")
|
|
sync(watch=False) # pyright: ignore
|