MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / backup_profiles

Function backup_profiles

scripts/init_profiles_from_roles.py:49–61  ·  view source on GitHub ↗
(db_path: Path)

Source from the content-addressed store, hash-verified

47
48
49def backup_profiles(db_path: Path) -> Path:
50 backup_dir = PROJECT_ROOT / "data" / "backups"
51 backup_dir.mkdir(parents=True, exist_ok=True)
52 timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
53 backup_path = backup_dir / f"profiles_backup_{timestamp}.json"
54
55 conn = sqlite3.connect(db_path)
56 conn.row_factory = sqlite3.Row
57 rows = [dict(row) for row in conn.execute("SELECT * FROM profiles ORDER BY user_id")]
58 conn.close()
59
60 backup_path.write_text(json.dumps(rows, ensure_ascii=False, indent=2), encoding="utf-8")
61 return backup_path
62
63
64def clear_profiles_only(db_path: Path) -> int:

Callers 1

mainFunction · 0.85

Calls 3

nowMethod · 0.80
executeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected