PhoenixKit.Migrations.Postgres.V213 (phoenix_kit v2.62.2)

Copy Markdown View Source

V213: the Default variant set gets smart-square sizes, on installs that have no files yet.

thumbnail_square (150 × 150) and small_square (300 × 300) are fixed boxes cropped around the subject of the photo (crop_mode = 'focus'): the squares a list row, a picker, an avatar or a tile grid wants, next to thumbnail and small, which keep proportions. They are what Storage.reset_dimensions_to_defaults/1 puts back too.

Only an install with no files is changed. Adding a size to a set makes every existing file's variants stale, and an operator who has tuned the Default set may not want two more renditions per photo; a site with files gets them by pressing "Reset to defaults" on the Default set (or adding them by hand), a new site gets them here. A size already in the set (an operator's own thumbnail_square, say) is left as it is.

Locks

Two INSERT … SELECT into the (tiny) renditions table, guarded by NOT EXISTS on phoenix_kit_files (an index probe). Re-runnable: the unique index on (variant_set_uuid, name) makes a second run a no-op.

Summary

Functions

Rolls V213 back: the two sizes go from the Default set, wherever they were added.

Functions

down(opts)

Rolls V213 back: the two sizes go from the Default set, wherever they were added.