Repository navigation
feat!: rename stored upload sizes field to variants - #18431
Merged
paulpopus merged 15 commits intoOct 5, 2026
Merged
Conversation
…o feat/file-transformers-sharp
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
r1tsuu
marked this pull request as ready for review
October 1, 2026 17:06
r1tsuu
requested review from
AlessioGr,
DanRibbens,
JarrodMFlesch,
denolfe and
jacobsfletch
as code owners
October 1, 2026 17:06
Base automatically changed from
feat/file-transformers-sharp
to
feat/file-transformers-core
October 5, 2026 11:39
Base automatically changed from
feat/file-transformers-core
to
feat/file-transformers
October 5, 2026 11:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Stacked on #18411. Draft.
What?
Upload documents now store generated image sizes under
variantsinstead ofsizes, matching thevariantsconfig option.How?
sizes-to-variantsmigration for each database adapter (MongoDB, Postgres, Vercel Postgres, SQLite, D1):payload migrate:create --file @payloadcms/db-<adapter>/sizes-to-variants. On SQL databases it renames the columns in place, so no data is lost.sizesstorage conflicts with customvariantsstorage.db-postgresanddb-vercel-postgresbuilds, which shippedmigration-utilsimporting a predefined-migration helper that was only published as.mjs, so importing@payloadcms/db-postgres/migration-utilsfailed.Breaking changes
Payload 4 uses
variantsas the top-level field for generated upload variants. An upload collection can already define a custom field with this name.If a collection has a custom
variantsfield, rename it before running the predefined migration:customVariants.variantsto the new field.sizes-to-variantsmigration after the custom data has moved.The predefined migration cannot choose a name or merge custom
variantsdata because Payload cannot determine the intended schema. It checks MongoDB documents, SQL columns, and SQL snapshots for conflicts and reports what must be moved before it can continue. A partly completed migration that contains only expected generated variant fields remains safe to retry.Testing
test/sizes-to-variantscovers the migration on MongoDB, SQLite and Postgres, including camelCase variant names and running inside a transaction, the waypayload migratedoes.variantscollisions, quoted SQL identifiers, SQLite retry and rerun behaviour, MongoDB partial filters and index options, text indexes, and incompatible destination indexes.sharp+imageSizes), using migrations for SQL.migrate-sharp-to-transformercodemod.sizes-to-variantsmigration.sizes/variantscolumns.migrate:down, migrate up again and compare.dbName, a collection without sizes, upload relationshipgenerateImageName, upload in an array,hasManyuploadgenerateImageName, avif size, upload in a block, polymorphichasManyuploadRuntime checks after the upgrade cover
whereandselectonvariants.*, generated files on disk, and new uploads. Index names match the v4 schema.Notes
templates/with-vercel-websiteinitial migration still createssizes_*columns and needs regenerating.Written with AI