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

Function _database_has_required_tables

scripts/runtime_bootstrap.py:66–82  ·  view source on GitHub ↗
(db_path: Path)

Source from the content-addressed store, hash-verified

64
65
66def _database_has_required_tables(db_path: Path) -> bool:
67 if not db_path.exists():
68 return False
69
70 try:
71 conn = sqlite3.connect(db_path)
72 try:
73 rows = conn.execute(
74 "SELECT name FROM sqlite_master WHERE type='table'"
75 ).fetchall()
76 finally:
77 conn.close()
78 except sqlite3.Error:
79 return False
80
81 table_names = {row[0] for row in rows}
82 return REQUIRED_TABLES.issubset(table_names)
83
84
85def ensure_database(root_dir: Path = PROJECT_ROOT) -> Path:

Callers 1

ensure_databaseFunction · 0.85

Calls 3

fetchallMethod · 0.45
executeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected