refactor!: always insert fields from storage adapters by default - #17871
Open
paulpopus wants to merge 2 commits into
Open
refactor!: always insert fields from storage adapters by default#17871paulpopus wants to merge 2 commits into
paulpopus wants to merge 2 commits into
Conversation
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖 |
nathanlentz
self-requested a review
August 20, 2026 18:42
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.
This PR makes storage adapters always insert the
prefixfield into the collection schema, and removes thealwaysInsertFieldsoption that used to control this.Summary
Storage adapters insert a
prefixfield into an upload collection only when the collection sets aprefix, or when thealwaysInsertFieldsoption istrue. This causes the collection schema to change when a project enables or disables cloud storage, or moves between environments. This PR removes that condition. Storage adapters now always insert theprefixfield, even when the plugin is disabled or no prefix is set. The schema stays stable across all environments.How
cloudStoragePluginand the field builder ingetFieldsno longer accept analwaysInsertFieldsoption. They insert theprefixfield unconditionally.enabled: false. When disabled, the adapter now callscloudStoragePluginwithadapter: nullso the schema field is inserted without enabling upload functionality.admin/index.tsandadmin/fields/getFields.ts) inplugin-cloud-storageare removed. Their logic duplicated the main plugin path and served no active import.Breaking Changes
The
alwaysInsertFieldsoption is removed fromPluginOptionsand from each storage adapter's options (S3StorageOptions,AzureStorageOptions,GcsStorageOptions,R2StorageOptions,VercelBlobStorageOptions). Every upload collection configured with a storage adapter now gets aprefixfield, even a collection that never sets aprefix, and even when the adapter is disabled.Before:
Without
alwaysInsertFields, disabling the plugin removed the prefix field from the schema.After:
The prefix field is now always present. Remove any
alwaysInsertFields: trueusage; it has no effect and will raise a type error. Collections that never configured a prefix now store an empty string in the prefix field instead of leaving it unset.