Merge pull request #3841 from liggitt/skew-alpha-fields
Add rationale for preserving persisted data for alpha fields
This commit is contained in:
		
						commit
						6a41010589
					
				| 
						 | 
				
			
			@ -930,6 +930,9 @@ The preferred approach adds an alpha field to the existing object, and ensures i
 | 
			
		|||
3. Before persisting the object to storage, clear disabled alpha fields on create,
 | 
			
		||||
and on update if the existing object does not already have a value in the field.
 | 
			
		||||
This prevents new usage of the feature while it is disabled, while ensuring existing data is preserved.
 | 
			
		||||
Ensuring existing data is preserved is needed so that when the feature is enabled by default in a future version *n*
 | 
			
		||||
and data is unconditionally allowed to be persisted in the field, an *n-1* API server
 | 
			
		||||
(with the feature still disabled by default) will not drop the data on update.
 | 
			
		||||
The recommended place to do this is in the REST storage strategy's PrepareForCreate/PrepareForUpdate methods:
 | 
			
		||||
 | 
			
		||||
    ```go
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue