Expand description
Revision — versioned snapshots of cms_page rows.
Captured on every page save in the admin. Each revision stores the
full page state as JSON; prune bounds storage.
Structs§
- Prune
Outcome - Outcome of one
prunesweep against a page. - Revision
- One row per save of a
Page.sequenceis a per-page monotonic counter starting at 1.
Enums§
- Field
Diff - One field’s diff outcome for the compare view.
Constants§
- DEFAULT_
KEEP_ LATEST - Default
keep_latestcap when the caller doesn’t override it.
Functions§
- capture
- Capture one revision for
page: a full-state snapshot under the page’s nextsequence. - diff_
snapshots - Compare two page revision snapshots field-by-field. Returns one
FieldDiffper declared diff field (seeDIFF_FIELDS), in declaration order. - ensure_
unique_ sequence - Give
cms_revisionits UNIQUE (page_id, sequence) index, so a concurrent save can’t reuse a sequence. Pages that already hold duplicates are renumbered first, in (sequence, id) order, which keeps their history’s order. Idempotent. - page_
sequences (id, page_id, sequence)of every revision of the given pages — light columns only, never the snapshots. The history screen uses it for the “latest” flag and the Compare link, which have to be right for a row at the edge of a page.- prune
- Prune old revisions for one page. Returns the count of rows deleted (0 when the page is already under the cap).
- prune_
all_ pages - Run
pruneagainst every page in the tenant. Best-effort — per-page failures log + continue so one bad page doesn’t abort the whole sweep. Returns the aggregated(pages_scanned, rows_deleted).