Skip to content

Lotes/sqlite-undo-log

Repository files navigation

sqlite-undo-log

Lines of Code Coverage Duplicated Lines (%) Technical Debt

Bugs Code Smells Vulnerabilities

Maintainability Rating Reliability Rating Security Rating

An undo log for SQLite 3

Example

First, wrap the SQLite client...

const database = new NodeSqlite3DatabaseImpl(":memory:");
const connection = await database.connect();

Then, create and install the undo log services...

const api = createUndoLogServices(connection)
const { setup } = api;
const log = await setup.initializeSingle();

Last, but not least: Record your actions and undo them if required.

await log.trackWithin(async () => {
  // <-- record all your INSERT, DELETE & UPDATE statements
});
await log.undo();

Installed table schema

File dependencies