# `PhoenixKit.Migrations.Postgres.V154`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v2.13.10/lib/phoenix_kit/migrations/postgres/v154.ex#L1)

V154: OpenGraph templates + hierarchical assignments
(`phoenix_kit_og` plugin).

## phoenix_kit_og_templates

Reusable OG canvas designs. `canvas` is JSONB so the structure can
grow new element types without a schema change. `preview_image_uuid`
is an optional pointer to a rendered cached preview.

## phoenix_kit_og_assignments

Binds a template to a scope inside a consumer module's hierarchy. The
`(module_key, scope_type, scope_uuid)` triple is unique — enforced via
a partial-index pair because PostgreSQL treats `NULL` as distinct:

- one row per `(module, scope_type)` when `scope_uuid IS NULL` (the
  module-wide default tier)
- one row per `(module, scope_type, scope_uuid)` when not null

`template_uuid` cascades on delete: removing a template wipes every
assignment that pointed at it.

All operations are idempotent.

# `down`

Rolls V154 back by dropping the two OG tables.

**Lossy rollback:** all templates and assignments are lost. Back up
before rolling back in production.

# `up`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
