Move a template fully between environments (local → live): container, projects, all
scenes + editable fields, shared colours/layers, its categories & tags, and the asset
files.
- export_template.py <slug> → a self-contained bundle (template.json + assets/). One
SQL query captures the whole tree as JSON; assets are resolved from template-media
references and copied in. Source DB via PSQL env (default = local docker).
- import_template.py <bundle> → idempotent SQL (pipe to target psql). Replaces by slug
via one cascading delete (all content.* FKs are ON DELETE CASCADE), recreates rows
verbatim (UUIDs preserved → FKs intact), merges categories/tags BY SLUG so they line
up across DBs. --assets-to copies media; docker cp / mc cp hints for remote.
- TEMPLATE_BUNDLES.md documents it.
Round-trip tested on fr-instagram-promo: DB → bundle → DB restores identical
3 projects / 15 scenes / 138 fields and field values.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>