Expand description
Bootstrap-time hydration of the six bundled themes + their brand colors into each tenant.
Theme rows live in fixtures/cms_theme.json and are loaded via
rustango::fixtures::Fixture — pure data, easy to diff / edit,
reproducible across tenants. Brand colors stay in code because
their theme_id FK has to be resolved against the just-inserted
row, which fixtures don’t natively handle.
§Idempotency
ensure_themes_seeded runs on every boot and reconciles by slug:
it inserts fixture themes whose slug the tenant lacks (with brand
colors) and never updates an existing row, so renames and recolors
survive. On a tenant that already has themes, new built-ins land
with is_default / is_admin_default cleared. A deleted bundled
preset comes back on the next boot, since its slug is missing again.
Functions§
- ensure_
themes_ seeded - Hydrate the bundled theme presets + their brand colors into the current tenant. Inserts every built-in theme whose slug the tenant lacks and never updates an existing row (see the module docs).