(client: Client, path: string)
| 1372 | }; |
| 1373 | |
| 1374 | const 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 | |
| 1388 | const checkpointSqliteFileSetIfBaseExists = async (path: string): Promise<void> => { |
| 1389 | if (!fs.existsSync(path)) return; |
no test coverage detected