Expand description
Page-builder storage models — migration-tracked, versioned.
No DDL runs when a Developer edits a schema: a structure change writes
a new draft row, and publishing flips draft→published (version+1)
while archiving the prior published row. Page values live in one stable
JSON store (PageBuilderData) and upgrade lazily. Tables are created
once by the generated 0006_page_builder migration, never altered by
the builder.
Structs§
- Component
- A reusable field-group (a component), referenced from
schemas by slug (
c_<slug>). - Page
Builder Data - The filled builder values for one page (additive to any code page type’s own extension table). One row per page.
- Page
Type Schema - A versioned body-schema document attached to a page type.
Constants§
- STATUS_
ARCHIVED - STATUS_
DRAFT - Lifecycle of a schema row. Exactly one
draftand onepublishedper page type at a time (code-enforced);archivedrows are history. - STATUS_
PUBLISHED
Functions§
- all_
components - Every reusable component, ordered by slug.
- component_
by_ id - One component by id.
- component_
map - Component library as a
slug → entrymap forcrate::page_builder::validate_schema/crate::page_builder::compile(). Malformed component docs are skipped. - component_
reference_ counts - How many live page-type schemas reference each of
slugs, from one scan of the schemas (whatcomponent_referenceswould count, for every slug at once). - component_
references - Page types whose non-archived (draft or published) schema references
a component slug — returns
(page_type_id, status)pairs. Used to block deletion of an in-use component. - create_
component - Create a component (version 1).
documentis aComponentDocJSON. - data_
for_ page - The stored builder values for a page, if any.
- delete_
component - Delete a component by id (no-op if it’s already gone).
- draft_
for - The draft schema row for a page type, if any.
- list_
versions - Published + archived rows for a page type, newest version first — the version history.
- publish
- Publish the draft: archive the current published row, flip the draft
to published with version = prev_published + 1. Returns the new
published row, or
Nonewhen there is no draft to publish. - published_
for - The published schema row for a page type, if any.
- save_
draft - Upsert the single draft for a page type with
document. Creates the draft (version = published+1) if none exists. - update_
component - Update a component’s metadata + document and bump its version so referencing schemas pick the change up lazily (next open / render). The slug is immutable (it’s the reference key).
- upsert_
data - Upsert a page’s builder values.