Skip to main content

Module seed

Module seed 

Source
Expand description

Per-tenant cms_page_type seeding.

At boot time the framework hooks Cli::seed(rcms::ensure_seeded), which fans out across every active Org and upserts one row per PageTypeHandler registered via crate::register_page_type! (or by hand via crate::PageTypeHandlerRegistration).

Idempotent — re-running on an already-seeded tenant overwrites the metadata fields (verbose_name, default_template, allowed_parent_types) but never touches the surrogate id, so existing FKs from cms_page.page_type_id remain valid.

Structs§

TenantSeeder
A host-registered per-tenant seeding pass.

Enums§

SeedError
Errors from ensure_seeded. Propagates the underlying tenancy / driver errors verbatim so callers can match on them.

Functions§

ensure_mcp_skills
Seed (or reconcile) the built-in MCP skills for one tenant. Idempotent: create_skill_pool is create-only, so on Duplicate we reconcile by adding any tool rows a newer CMS version introduced (never removing — operator customizations survive); the skill↔permission mappings are idempotent upserts.
ensure_seeded
Walk every active Org and ensure the tenant has one cms_page_type row per registered PageTypeHandler.
ensure_tenant_seeded
Seed org if this process hasn’t yet. A tenant provisioned while the server runs — operator console, provisioning webhook, create-tenant — gets its tracked migrations but missed the boot-time seed, so it had no page types, roles or locale until a restart. One tenant is seeded at a time, and a second request for it waits rather than seeding again.
grant_codename
Grant codename to the role named role_name, if it isn’t already.
seed_tenant
Everything a tenant needs beyond its tracked migrations: registry rows for page, library and taxonomy types, themes, roles, the default locale, the ensure-only tables and columns, MCP skills and the host’s seeders. Idempotent. Run for every tenant at boot, and for a tenant provisioned while the server runs on its first request.

Type Aliases§

SeedFuture
Boxed future returned by a TenantSeeder.