Audit Migrations
Audit database migrations.
NIST AU-11: Audit records must not be lost during schema evolution. All migrations use ALTER TABLE (non-destructive) to preserve existing data.
Properties
v1 -> v2: Add userId column for GDPR data subject tracking.
v2 -> v3: Add monotonic seq and formatVersion to events, prune watermark and last acknowledged checkpoint seq to chain state. Existing rows get seq in rowid order. audit_events has a TEXT primary key, so it is a rowid table and rowids grow with insertion: rowid order is the order the chain was built in. ids are random UUIDs, so (ts, id) would misorder same-millisecond events and events across a backward clock step. Caveat: VACUUM may renumber rowids of a table without an INTEGER PRIMARY KEY; Room never vacuums, and the SDK does not either.