MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / checkpointTruncate

Function checkpointTruncate

apps/local/src/db/v1-v2-migration.ts:1374–1386  ·  view source on GitHub ↗
(client: Client, path: string)

Source from the content-addressed store, hash-verified

1372};
1373
1374const checkpointTruncate = async (client: Client, path: string): Promise<void> => {
1375 const result = await client.execute("PRAGMA wal_checkpoint(TRUNCATE)");
1376 const row = result.rows[0] ?? {};
1377 const busy = Number(row["busy"] ?? 0);
1378 const log = Number(row["log"] ?? 0);
1379 const checkpointed = Number(row["checkpointed"] ?? 0);
1380 if (busy !== 0 || log !== checkpointed) {
1381 throw new LocalV1V2MigrationError({
1382 message: `Could not fully checkpoint SQLite WAL for ${path}`,
1383 cause: row,
1384 });
1385 }
1386};
1387
1388const checkpointSqliteFileSetIfBaseExists = async (path: string): Promise<void> => {
1389 if (!fs.existsSync(path)) return;

Callers 3

verifyStagingDatabaseFunction · 0.85

Calls 1

executeMethod · 0.65

Tested by

no test coverage detected