@@ -146,9 +146,9 @@ The returned data must:
146146
147147- Preserve all relevant stored values.
148148- Set ` schema_version ` to the next version.
149- - Be valid input for the next migration or the current model.
149+ - Be valid input for the next migration function or the current model.
150150
151- ### 3. Register the migration
151+ ### 3. Register the migration function
152152
153153Update ` project_config/__init__.py ` :
154154
@@ -162,10 +162,10 @@ PROJECT_CONFIG_MIGRATIONS: dict[int, MigrationFunction] = {
162162}
163163```
164164
165- The registry key is the source schema version. Key ` 1 ` registers the migration from
166- version 1 to version 2.
165+ The registry key is the source schema version. Key ` 1 ` registers the migration
166+ function from version 1 to version 2.
167167
168- Keep every migration when later versions are added:
168+ Keep every migration function when later versions are added:
169169
170170``` python
171171PROJECT_CONFIG_MIGRATIONS : dict[int , MigrationFunction] = {
@@ -185,7 +185,7 @@ When you add a migration:
185185- Add resource-specific tests under ` tests/test_migrations/ ` . For example, a
186186 ` ProjectConfig ` migration can use ` test_project_config_migration.py ` .
187187
188- The resource-specific tests must cover conversion , load, save, cache restore, and
188+ The resource-specific tests must cover migration , load, save, cache restore, and
189189invalid data. Update the complete current version fixture used by
190190` tests/test_resources/test_migratable_models_up_to_date.py ` . Keep the previous
191191version input with the resource-specific migration tests.
@@ -205,7 +205,7 @@ uv run mypy src tests
205205Migration is automatic during normal use:
206206
2072071 . The resource manager reads stored data from an older schema.
208- 2 . The migration manager converts it in memory.
208+ 2 . The migration manager migrates it in memory.
2092093 . The resource manager returns the current validated model.
2102104 . The stored file remains unchanged until a save occurs.
211211
@@ -223,21 +223,27 @@ On the first save:
223223Loading a resource does not create a changelog entry. A later user update or
224224restore uses the existing changelog behavior.
225225
226+ ### Cache restore
227+
226228When an old cache revision is restored by the current release, it is migrated before
227229it is written. The resource file therefore uses the current schema after the restore.
228- If you roll back to an older release while the pre-migration revision is retained,
229- restore that revision with the older release to return the resource file to the older
230- schema. Migration backups are not read or restored by the library, copy one back
231- manually when the cache revision is no longer available.
230+
231+ ### Rollback to an older release
232232
233233Migrations are forward-only. After current-schema data is saved, an older
234- ` fmu-settings ` release can reject it as newer than its supported schema.
234+ ` fmu-settings ` release can reject it as newer than its supported schema. If the
235+ pre-migration revision is retained, restore that revision with the older release to
236+ return the resource file to the older schema. Migration backups are not read or
237+ restored by the library. If the cache revision is no longer available, we should help
238+ users copy the appropriate migration backup back to the resource file before running
239+ the older release.
235240
236241## Release checklist for an ` fmu-settings ` schema version
237242
238- Use this checklist when releasing an ` fmu-settings ` package that contains a new
239- stored schema version. First prepare and publish ` fmu-settings ` . Then update the
240- downstream applications so that users receive the new package.
243+ Use this checklist when releasing an ` fmu-settings ` package with an updated
244+ schema version in one of the migratable models. First prepare and publish
245+ ` fmu-settings ` . Then update the downstream applications so that users receive
246+ the new package.
241247
242248### 1. Prepare the ` fmu-settings ` package
243249
0 commit comments