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

Function writeMigrationJournal

apps/local/src/db/v1-v2-migration.ts:1156–1163  ·  view source on GitHub ↗
(path: string, journal: MigrationJournal)

Source from the content-addressed store, hash-verified

1154const migrationJournalPath = (sqlitePath: string): string => `${sqlitePath}.v1-v2-migration.json`;
1155
1156const writeMigrationJournal = async (path: string, journal: MigrationJournal): Promise<void> => {
1157 fs.mkdirSync(dirname(path), { recursive: true });
1158 const tmp = `${path}.tmp-${journal.nonce}`;
1159 fs.writeFileSync(tmp, `${JSON.stringify(journal, null, 2)}\n`, { mode: 0o600 });
1160 fsyncFileIfExists(tmp);
1161 await renameWithRetry(tmp, path);
1162 fsyncDirectory(dirname(path));
1163};
1164
1165const removeMigrationJournal = (path: string): void => {
1166 fs.rmSync(path, { force: true });

Callers 2

completeJournaledFlipFunction · 0.85

Calls 3

fsyncFileIfExistsFunction · 0.85
renameWithRetryFunction · 0.85
fsyncDirectoryFunction · 0.85

Tested by

no test coverage detected