PhoenixKit.Migrations.Postgres.V195 (phoenix_kit v2.29.1)

Copy Markdown View Source

V195: image editing.

An edited image keeps its uuid — every module that stored it keeps pointing at it — and its original instance becomes the edited bytes. The unedited original moves to a hidden, system-managed child file, so the owner can restore or delete it but nobody else can reach it. These columns record that on phoenix_kit_files:

  • edits (jsonb) — the current edit (PhoenixKit.Modules.Storage.ImageEdit), always applied to the unedited original
  • edit_revision (integer, default 0) — bumped by every save and revert, so a job can tell whether its snapshot is still the one wanted
  • edit_state (varchar(16)) — nil, "pending" or "failed"; while it is set the file is served as a placeholder, never as the old bytes
  • original_file_uuid — on an edited file, its hidden unedited backup
  • edited_from_uuid — on a "save as copy" result, the file it came from

Both references are ON DELETE SET NULL: the backup's own lifecycle follows parent_file_uuid (cascade), and a copy outlives its source.

It also indexes phoenix_kit_file_instances.file_name: a stored object is now deleted only when no instance row still references its key, and that check runs on every deletion.

Additive only; re-runnable.

Summary

Functions

Rolls V195 back: drops the columns and the index. Edits are lost; files keep their current bytes.

Functions

down(opts)

Rolls V195 back: drops the columns and the index. Edits are lost; files keep their current bytes.

up(opts)