PhoenixKit.Migrations.Postgres.V96 (phoenix_kit v1.7.104)

Copy Markdown View Source

V96: Attach catalogue items directly to a catalogue.

Adds a nullable catalogue_uuid FK on phoenix_kit_cat_items so items can belong to a catalogue independently of having a category. This lets "uncategorized" items (items with no category) still be scoped to a catalogue instead of floating in a global pool.

  • Adds catalogue_uuid column with a FK to phoenix_kit_cat_catalogues (on_delete: :nilify_all) — in-app cascades handle soft-delete lifecycle
  • Backfills existing items from their category's catalogue_uuid
  • Pins any remaining orphans (items with no category at all) to the oldest non-deleted catalogue so they stay visible in the UI
  • Adds indexes on catalogue_uuid and (catalogue_uuid, status)

All operations are idempotent.

Summary

Functions

Rolls V96 back by dropping the catalogue_uuid column (and its indexes).

Functions

down(opts)

Rolls V96 back by dropping the catalogue_uuid column (and its indexes).

Lossy rollback: items that were created after V96 as uncategorized (no category) have their catalogue linkage stored solely in catalogue_uuid. Dropping the column means those items can no longer be attributed to a catalogue — they'll become global orphans again (their pre-V96 shape). Back up before rolling back in production.

up(opts)