Remote / foldkit-remote-drizzle

revisionTrigger

function · packages/remote-drizzle/src/index.ts:1056

function revisionTrigger(binding: AnyEntityBinding, revision: string): string

The SQL that makes a database move binding's revision on every update that does not move it itself: a handler's, applyEdits', raw SQL. A guarded writer pinned to the revision then sees every change, not only those of writers that cooperate. An update that sets the revision itself (a declared write's, by one; a journal's, to a sequence) is left as it set it, so nothing moves twice. Migrate with it once:

ts
sqlite.exec(revisionTrigger(Db.Todo, 'revision'))

Not for a table Sync writes: applyEdits sets the revision to a commit sequence, and a second change in one operation keeps it, which the trigger would move past that sequence.