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

Copy Markdown View Source

V214: a rendition can be for wide or tall pictures only, and the Default set gets a mini square and three panorama sizes.

phoenix_kit_storage_dimensions.shape says which pictures a rendition is made for:

  • any (the default, and what every existing rendition keeps): every picture;
  • wide: only a picture whose aspect_ratio is Storage.Shape.wide_min/0 or more (a panorama), so an ordinary photo is not given a second, near-identical file;
  • tall: the same for a picture Storage.Shape.tall_max/0 or less.

The shape is not part of a rendition's spec hash (it does not change a pixel), so no existing rendition is remade by this migration.

The new sizes reach installs that have no files yet (as in V213): a site with files gets them from "Reset to defaults", because adding a size makes every existing file stale. They are in the Default set:

  • mini_square: 64 × 64, quality 70, cropped around the subject. For the zoomed-out views (a month, a year) where a cell is a few dozen pixels;
  • thumbnail_wide, small_wide, medium_wide: 150, 300 and 800 px tall and as wide as the picture needs, for panoramas only.

A size already in the set under that name (an operator's own) is left as it is.

Locks

ALTER TABLE on the (tiny) renditions table; the default is a constant, so no row is rewritten. Four INSERT … SELECT guarded by NOT EXISTS on phoenix_kit_files. Re-runnable.

Summary

Functions

Rolls V214 back: the four sizes and the column go.

Functions

down(opts)

Rolls V214 back: the four sizes and the column go.