MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / main

Function main

methods/MIRIX/scripts/reset_database.py:392–437  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

390
391
392def main():
393 parser = argparse.ArgumentParser(description="Mirix Database Reset Script")
394 parser.add_argument(
395 "db_type",
396 nargs="?",
397 default="auto",
398 choices=["auto", "postgresql", "postgres", "pg", "sqlite", "sqlite3"],
399 help="Database type (default: auto-detect)",
400 )
401 parser.add_argument("--host", help="PostgreSQL host")
402 parser.add_argument("--port", help="PostgreSQL port")
403 parser.add_argument("--user", help="PostgreSQL user")
404 parser.add_argument("--database", help="PostgreSQL database name")
405 parser.add_argument("--sqlite-path", help="SQLite database path")
406
407 args = parser.parse_args()
408
409 try:
410 log_info("Starting Mirix database reset...")
411
412 # Determine database type
413 if args.db_type == "auto":
414 db_type = detect_database_type()
415 else:
416 db_type = args.db_type
417
418 log_info(f"Database type: {db_type}")
419
420 # Reset based on database type
421 if db_type in ["postgresql", "postgres", "pg"]:
422 reset_postgresql(args.host, args.port, args.user, args.database)
423 elif db_type in ["sqlite", "sqlite3"]:
424 reset_sqlite(args.sqlite_path)
425 else:
426 log_error(f"Unsupported database type: {db_type}")
427 sys.exit(1)
428
429 log_success("Database reset completed!")
430 print()
431 log_info("Next steps:")
432 print(" 1. Restart your Mirix application")
433 print(" 2. The application will automatically recreate the database schema")
434
435 except Exception as e:
436 log_error(f"Database reset failed: {str(e)}")
437 sys.exit(1)
438
439
440if __name__ == "__main__":

Callers 1

reset_database.pyFile · 0.70

Calls 6

log_infoFunction · 0.85
detect_database_typeFunction · 0.85
reset_postgresqlFunction · 0.85
reset_sqliteFunction · 0.85
log_errorFunction · 0.85
log_successFunction · 0.85

Tested by

no test coverage detected