Model evolution
Vox compares the deployed model with its stored snapshot and applies the changes it can infer. Declare a migration for changes that need an explicit mapping.
For the team workflow, see Change the model.
A Vox model changes as the business does: entity types and properties are renamed, a property changes type, a field becomes filterable or unique, or a concrete type becomes a family of kinds. Vox compares the model in code with the model it last applied to the stored data and plans the difference. Changes it can make safely need nothing; changes it can't infer are declared once, in a model migration class.
The applied model
Vox stores a semantic snapshot of what's deployed, the applied model: every entity type, kind, field and unique constraint with its stable key, its current name, its value type, its query capabilities and its storage. A key is assigned the first time something is applied, from its name then, and is never changed. A rename changes the name and keeps the key.
Everything internal is keyed by keys: tables and columns, relation tables, Redis keys, Elasticsearch indexes, cells,
history and the dependencies of calculations, cached references, memberships and assessments. Names appear only at the
boundaries: the API, events, contracts, snapshots, permissions, Elasticsearch aliases, import queues and entity projection
publications. So after Item is renamed to Product its table can still be called
Vox_Item; the Model page of the admin UI and GET /vox/api/model show the mapping. Keys are local to an
installation and never appear in exchanged contracts or payloads. One exception: an Entity Framework relation row stores
the name of the entity type it links to, so a rename rewrites those rows in the background, together with the grants
and subscriptions that name the type and what those subscriptions have selected of it, so that a product that leaves a
subscription's maintained query after the rename is still sent as removed. That step runs before the other steps of the migration, so a step that waits, eg
a unique constraint waiting for duplicates to be fixed, doesn't hold it up. Until it has run, filters by such a
relation miss the links written before the rename.
An import queue is named after its import type, which is the name of an external entity type imported as a whole, or
the class name of an import, since Nexus sets the queues up when a host starts. So a release that renames either
starts a new queue, eg vox_ent_product next to vox_ent_item, and the imports still waiting in the old one aren't
applied: no job reads that queue any longer, and their messages name the old import type. Imports are usually applied
within seconds, so let the import queues of a renamed type drain before you deploy such a release, eg by pausing the
system that sends them, and send whatever was left in the old queue again afterwards. The same goes for a release that
changes the shape of an import, eg renames one of its properties: an import that waits in the queue is read with the
class of the release that applies it, so a value it has under the old name is lost.
An entity projection publication is named after its entity type, eg Item/feed, and that name is also the key of its
state: what it has published of each source, its pending sources, its dependencies and, for a route publication, the
routes it owns. After a rename the publication is Product/feed and starts without them, so add
RebuildPublications for it to the migration that renames the type. The old publication's rows stay: a document whose
source stops producing one isn't deleted from the sink, since the record of what was published is under the old name,
and a route publication's old routes stay in the routing tables, where every URL is then reported as published twice.
Remove the old publication's documents from the sink and its routes by hand after the rebuild. The warnings and other
assessments the publication produced are kept by the entity type's key, which a rename doesn't change, so the rebuild
replaces them like any other run does. Rich text keeps the name an embedded entity had when the text was saved, so an
embed saved before the rename still names Item, eg vox://entity/Item/p1, and a delivery doesn't resolve it to the
product's projection: its key isn't in the response's projections. Saving the text again keeps the old name;
inserting the embed again stores Product.
Migrations don't rewrite people's personal changes of the admin UI, eg a field they moved to another section or a column they added. A change that no longer fits the model is ignored, and the person sees it listed with a Reset where they make changes, so they can remove it or make it again.
A removed type or field retires its key. Adding a type with a former name later gives it a new key, so it never gets the stored data of what was removed.
Each entity type has a model revision that increases with every applied change to how its documents are read or written. Every stored document, ie entity rows and their previous data, cells, history versions and Redis hashes, is stamped with the revision it was written at.
Automatic changes
These need no migration class:
| Change | What Vox does |
|---|---|
| Add an entity type, kind or optional property, also to the objects in a collection or dictionary | Nothing is rewritten. New calculated fields are calculated when their entities change, or for every entity when a migration declares Recalculate. An added property, also a relation, a unique, varying or computed one or a field of a field set, is compatible with the previous release during a deployment. An added required property needs a FillProperty step. |
Widen a type: int to long, float to double, T to T?, add an enum member | Documents are read as the new type. A filterable or sortable property gets a new query generation. Enums are stored by their names, so reordering their members changes nothing, while renaming or removing a member is a change to declare. |
| Become or stop being filterable, sortable or searchable | A new query or search generation is built, or the capability is removed. |
| Add or remove a unique constraint | A new constraint is built and checked for duplicates before it's enforced. |
| Remove a calculated property, or change its type | The stale value is removed, and a retyped calculation runs again. |
| Change which calculation creates an entity type, or which calculation calculates a field | The next model activation calculates that calculation again for all of its roots. |
| Turn a concrete type into a family | Stored entities without a kind are read as the kind marked isDefault: true. |
Add or remove [VoxLightEntity] | The entities are moved online to the light or the full layout, keeping their ids, versions, cells and relations. |
| Keep an entity type whole in memory, or stop | A new model revision, so every instance that writes it records its changes. No data is moved. |
| Change labels, descriptions, editor hints, actions or validators | Nothing. |
So an int property that becomes long and isn't filterable needs nothing at all. If it's filterable, Vox builds a
bigint generation of its query storage next to the old one and switches to it. The same goes for the objects of a
collection: a List<Variant> whose Variant gets an optional Color needs nothing, while a removed or newly required
member of Variant is a change to declare.
Canonical names and CLR names
A property has two names. Its canonical name is its name in JSON: its [JsonPropertyName] exactly as it's written,
or else its CLR name in camel case. Its CLR name is only how C# accesses it. Everything Vox stores, exchanges or
lets you refer to by a string uses the canonical name: stored entities, the paths of fields, filters and sorts, the
editor's paths, actions and their payloads, subscriptions, contracts and dependencies. A nested property's path has the
canonical name of every object on the way, eg editorial.title.
So pinning the canonical name lets you rename the CLR property freely. This property:
public virtual string? Title { get; set; }
can become this one without a migration:
[JsonPropertyName("title")]
public virtual string? Name { get; set; }
and later DisplayName, keeping [JsonPropertyName("title")]. Each is a change of the C# API only: the applied model,
the stored JSON, the query columns and indexes, the unique constraints, the relations and their keys, and the names of
the default actions stay the same, and nothing is rewritten, rebuilt, recalculated or resynchronized. Code that used
Title uses Name instead, and a typed expression such as product => product.Name still means title. The same goes
for the properties of objects, also in lists, dictionaries and varying values, and for the names and namespaces of the
classes of those objects.
Changing the canonical name itself is a real rename, eg [JsonPropertyName("heading")], or renaming Title to Name
without pinning title: declare it with RenameProperty("title", "heading") or [VoxRenamedFrom("title")]. Vox never
treats a property with the same CLR name as the same field.
The names Vox derives from properties follow the canonical name when it's declared and the CLR name otherwise, so a
model without [JsonPropertyName] keeps the names it always had:
| Derived name | Without a declared name | With [JsonPropertyName("custom_name")] Name |
|---|---|---|
| Default action | SetUrlLinks for URLLinks | SetCustomName |
| Default relation name | uRLLinks for URLLinks | customName |
| Default unique constraint name | ContentCode for Content.Code | CustomName |
Default actions are named in PascalCase from the canonical path, where every character that can't be in a C# identifier,
and _, starts a word, eg editorial.title is SetEditorialTitle and list-price is SetListPrice. Two paths that
give the same name, eg custom_name and customName, are a model error rather than told apart. The generated command
classes keep following the CLR names, eg ProductActions.SetName is the command of the action SetTitle.
The relations and unique constraints themselves aren't in the applied model, and nothing renames a relation key, a
relation name or a constraint. Renaming the canonical name of a relation property, eg related to accessories, or of a
property that a default unique constraint name is derived from, therefore changes them, and is done with a migration
that moves their data. Pin the canonical name before renaming such a property in C#.
A canonical name can't contain ., [, ], {, }, ,, =, ! or :, which separate the parts of Vox's paths. An
override must declare the same [JsonPropertyName] as the property it overrides, since System.Text.Json only reads a
property's own, and the properties that Vox manages, eg Id and CreatedAtUtc, keep their names.
Declared changes
A change Vox can't infer is declared in a class implementing IVoxModelMigration, registered like the other types of
the application:
public class RenameItemToProduct : IVoxModelMigration
{
public string Id => "2026-11-02-rename-item-to-product";
public void Configure(IVoxModelMigrationBuilder migration)
{
migration.RenameEntityType("Item", "Product", keepRouteAlias: true);
migration.Entity<Product>(product =>
{
product.RenameProperty("title", p => p.Name);
product.ConvertProperty<string?, decimal>(p => p.Weight,
weight => decimal.Parse(weight!, CultureInfo.InvariantCulture), VoxConversionFailure.Quarantine);
product.RemoveProperty("legacyCode");
});
}
}
The steps are renames of entity types, properties and kinds, conversions, removals and clears of stored values,
FillProperty for the value of an added required property, TransformDocument for changes of the JSON of one
document, RemapKind, RemoveEntityType, and explicit
Recalculate, Reassess and RebuildPublications. A rename can also be declared beside the class or property with
[VoxRenamedFrom("title")].
Renaming or removing a field doesn't change the selectors that name it. A selector that names a field that isn't filterable any more fails when it runs, with an error that names the field, and the admin shows the condition as broken so an editor can choose another field or remove it.
A transform also runs on partial documents: the cells of drafts, releases and contexts, which only have the values that differ from the entity's. Its context says which it got. A transform that fills in a missing value only does it in complete documents, since a value in a partial one would override the entity's:
product.TransformDocument((document, context) =>
{
if (!context.IsPartial)
{
document["status"] ??= "active";
}
});
A migration is applied once, and installations that skip releases still run it later, so don't change what an
applied migration does. Editing it is allowed, eg to follow a renamed class, but keep the names it refers to: use
Entity("Product", ...) with JSON paths rather than Entity<Item>(...) with expressions once the class is renamed,
since its conversions and transforms are identified by the entity type and property names it was applied with.
A conversion has a failure policy for values it can't convert:
Fail, the default: the model is only applied after a full preflight found no such value. A preflight that was interrupted continues where it stopped when it runs again, and from when it starts every save records what it writes of the entity types the plan changes. Applying the plan blocks their writes for a moment and validates what was written since the preflight started, so a value written meanwhile can't slip through.UseDefault: the property gets its default value, and the old value is recorded as a migration issue.Quarantine: likeUseDefault, and the entity is listed for repair on the Model page.
Converters, fills and transforms run whenever an old document is read, so they must be deterministic and free of side effects.
Filling an added required property
A C# required property that you add has no value in the stored documents. Declare where it comes from with
FillProperty, eg a product code made from the name:
migration.Entity<Product>(product =>
product.FillProperty(p => p.Code, document => document["name"]?.GetValue<string>()?.ToUpperInvariant() ?? ""));
The function gets the stored document and returns the value. It runs when a document of the entity without the
property is read, and on the stored documents in the background. In a draft or release it fills the entity's document
there too, but a draft that didn't change the property keeps reading the published value, so the fill only decides the
value of an entity that the draft creates. Values at contexts aren't filled. On an entity family, only the kinds that
have the property get it, and a nested property isn't filled in an object that's null. FillProperty only applies to a property that the same release adds; filling an existing property is a conversion or a
transform. Without it, the model isn't applied: the plan asks you to declare a fill or to make the property optional.
A release whose only document steps are fills stays compatible with the previous release, which doesn't know the property and skips it. A product that the previous release saves during the deployment gets its code when the new release reads it, and its stored document is rewritten afterwards, so the migration completes once nothing is left to fill.
Ambiguity stops the migration
Vox never guesses. A property that disappeared while another appeared, an incompatible type change without a converter, a removed owned property without a removal step, or an added required property without a fill stops the migration before anything changes, with the declaration that resolves it:
Product: property title was removed and name was added. Declare
RenameProperty("title", "name")if they're the same field, orRemoveProperty("title")if title's data should be removed.
Online by default
A changed model is online from the moment it's applied:
- Upgrade on read. A document written at an earlier revision is upgraded by the chain of steps between the two revisions before it's deserialized, in every storage and representation, so new code reads old documents correctly right away.
- Convergence. A background step rewrites the documents that need a persisted change, a batch at a time from a durable cursor. It's storage maintenance: it doesn't change versions, write history or emit events, and it only rewrites a row that hasn't changed since it was read. A conversion that changes what a value means records a change of the field, so the calculations, assessments and publications that read it run again; a write that upgrades a document before the convergence does records the same change. History is rewritten to the current model.
- Index generations. A new or changed query field or unique constraint gets a new generation of its storage, which is filled next to the current one. Queries read the generation that can represent every value of the new model.
Transient entity types
Transient entity types, eg carts, have no convergence, in either storage. A model change
that raises the revision of Cart, eg a ConvertProperty on Cart.lines, finishes without touching the stored carts:
each cart is upgraded when it's read, and written in the new revision the next time it's written. A cart that's never
written again, eg an abandoned one, keeps its old form for as long as it exists.
So a migration class of a transient entity type is needed as long as documents written before it can exist. With
no convergence, Vox considers the migration complete at once and doesn't stop you from deleting the class, but reading
a cart written before it then fails with an error that names the migration and asks to restore it. Say a cart line's
Quantity changes from int to decimal with a ConvertProperty, and the class is deleted a week later: every cart
abandoned before the change fails to read. Keep the class for the type's lifetime after the migration was applied, eg
30 days for carts that expire 30 days after their last change, see
Expiration. For a transient entity type without a lifetime, keep it until the
type's data is reset.
A transient entity type in Redis has no index backfill or cleanup either: a field that starts being indexed covers the carts written after the change, and the entries of a field that stops being indexed, or whose value format changes, stay until the storage is reset, see Model changes. Entity Framework storage builds the query storage of a new query field of a transient entity type as for any entity type.
Adding [VoxTransientEntity] to an existing entity type, removing it, or changing the transient storage can move the
type to another storage, eg from Entity Framework to Redis. That move isn't handled: the data stays in the old storage,
and the application moves it or resets it.
Partial results while capabilities build
The storage of a new or changed query field isn't a step of the migration. The migration marks the field's storage as
being built and completes without waiting for it, and Vox fills the storage from the stored entities in the background,
on one processing host at a time, while the system runs (vox_query_storage_builds, see
background work). Once an entity type's entities are all done, its
fields are marked ready and the work that waited for them runs. Say a migration adds a Brand filter to 3,000,000
products: the migration completes at once, and its other steps, eg the recalculations, don't wait for 3,000,000 rows to
be indexed. The health check shows which entity types are being built, and is degraded while the build keeps failing.
While a query generation builds, its field is pending: queries that filter or sort by it are served, but can return
partial results, including counts and pages. The metadata API (isPending on query fields) and the Model page show it.
Wait for readiness before routing correctness-sensitive traffic to a new capability. Vox's own calculations,
assessments, memberships and publications that query a pending field in the background are deferred until it's ready,
without failing or committing partial output. A save whose calculation queries a pending field fails with a transient
VoxCalculationFailedException (a 503 from the API) until it's ready, so release the index before a calculation that
queries it. A step of a migration that runs into it, eg a recalculation whose calculation filters on the
new field, waits and is tried again instead of failing, and the migration completes once that step does. A pending
unique constraint isn't enforced: duplicates stop it before activation, are listed on the Model page, and it's
activated once they're resolved.
Transforms, clears and kind changes
Some steps change stored values without changing a field's type: TransformDocument, ClearProperty of a property
that keeps its type, and RemapKind and RenameKind, whose kinds are stored by name. Vox keeps the query and unique
storage of the entity type in step with them, as if every entity had been saved again. The migration still completes
without waiting.
- A transform, a kind remap or a kind rename rebuilds the query storage of the entity type in place, in the
background after the migration, by the same build that fills a new query field (
vox_query_storage_builds). Vox can't tell which values a transform changes, so no field is marked pending. That has a price: until the build reaches an entity, queries, and Vox's own calculations, assessments, memberships and publications that query the type, see its old values. Say a transform normalizesstatusfrom"active"to"Active"on 2,000,000 products: a feed that publishes the products wherestatus == "Active"may be published short while the build runs. When the build of the type completes, everything that queries the type is evaluated again, so the feed is published in full. ABlockingmigration doesn't wait for the build either, since it isn't a step of the migration. - A cleared property is correct at once. Its query storage gets a new generation, which starts empty, so filtering on an old value returns nothing from the moment the migration is applied, and nothing waits. If the entity type has computed query fields, which may read the cleared property, its query storage is rebuilt in place as for a transform.
- Unique constraints are built again. A transform builds every unique constraint of the entity type again, and a clear builds those that contain the cleared property, as a new generation. Until a constraint's build has checked the stored values, it isn't enforced, also when the transform never touched its properties. A duplicate the transform made, eg two SKUs that become equal once a suffix is removed, is listed on the Model page and keeps the constraint unenforced until it's resolved.
vox migrate --plan lists each rebuild, eg "Query storage of Product is rebuilt in the background, since it's
transformed" and "Unique constraint Sku is built again, since Product is transformed". A transform of an entity type
without query storage or unique constraints, a clear of a property without them, and anything of an entity type in
storage without query storage of its own, such as Redis, rebuild nothing. The search index has its own rules, below.
The search index
With a search index (AddElasticsearchSearchIndex), queries and searches of an indexed entity type read copies of the
entities that were stored in the index when they were published. A migration keeps those correct in two ways:
- Reads are correct at once. Each copy in the index records the model revision it was written at, and is upgraded
when it's read, like a stored document. Right after
RenameProperty("title", "name"), a product returned by a query or a search has itsname, and afterRemapKind("bike", "bicycle")a converted bike is read as a bicycle instead of failing the query. - Indexed values catch up in the background. A migration that may change what the index filters, sorts or searches
by builds a new index of the entity type: a transform, a kind remap or rename, or a rename, removal, clear or
conversion of a filterable, sortable or searchable property, or of any property when the entity type has a computed
query field. The new index is filled from the stored entities next to the old one, as when query fields change (see
querying and search), and replaces it when it's
complete. Until then, the old index answers queries with the old values: after a transform that changes
statusfrom"active"to"Active", filtering onstatus == "Active"misses the products the fill hasn't reached, and a search still finds words a transform removed. Vox's own calculations, assessments, memberships and publications read the database meanwhile, so they never act on the old values. The migration doesn't wait for the fill, also aBlockingone.
The fill reads every entity of the type, a page of 500 at a time, so it takes as long as filling the index for the first time: for 2,000,000 products, 4,000 pages. A rename or conversion of a property that isn't a query field only needs the upgrade on read and rebuilds nothing, nor does a migration of an entity type that isn't indexed.
Blocking migrations
migration.Blocking() or migration.Blocking("Product") rejects writes to the affected entity types, and pauses their
processing, until every step is complete. Writes fail with a retryable error, HTTP 503 with Retry-After; reads are
served. A data step that reads and writes other entities, RunDataStep, requires blocking. Blocking covers entity
types, not the installation: other types keep working. Building the storage of a query field isn't a step, so writes
are admitted again while it's still being built, see above.
Entity types stored in Redis can't be blocked, so they can't have data steps either. The planner refuses a blocking
migration that blocks one, also when it's blocked only because a step of the migration touches it, and vox migrate
stops with a message that names the migration and the entity type. A migration that has a data step on an Entity
Framework type and converts a Redis type is refused too; split it in two. Convert the documents of a Redis type with
ConvertProperty or TransformDocument instead, which are applied when an entity is read: a cart changes shape as it's
loaded, and is written in the new shape the next time it's written, see
Transient entity types.
A host still on the previous model keeps writing a Redis type after its revision is raised, eg by a ConvertProperty
on Cart.items, since nothing in Redis stops it. It can't overwrite a cart that a newer host already wrote, and a cart
it writes in the old shape is upgraded when it's read, as long as the migration that converts it is still in the code.
So keep a Redis type's migration until every host runs the new model, and at least as long as
transient entity types need it.
Deploying a changed model
For development, the model is applied at startup. For production, apply it from the deployment pipeline while the previous version serves traffic, and make startup require it:
dotnet MyApp.dll vox migrate --plan # print the plan, change nothing
dotnet MyApp.dll vox migrate --preflight # validate the stored values against the conversions
dotnet MyApp.dll vox migrate # apply the model and run its steps
The last line of Program.cs, await app.RunVoxAsync(args), runs the commands: it runs the command the arguments
name, sets the process's exit code and stops, without serving. The command comes first in the arguments, as above, and
the command reads the same configuration as the hosts, eg ConnectionStrings__Vox from the pipeline's environment.
Set VoxEntityFrameworkOptions.RequireAppliedModel so that an application starts only once its model has been applied.
Applying the model does only bounded work; the steps continue in the model migration loop of the processing hosts, and
resume after a restart. The steps over stored data, eg convergence, removals and query storage builds, run also before a
new deployment is activated. The derived steps, which hand work to the processing that runs the application's code,
eg recalculating a calculation for every entity, a reassessment or a full build of a projection publication, wait until
the new deployment is active, so its own code does that work rather than the previous release's. vox migrate reports
them as waiting for the activation and succeeds once only they are left. An instance with an older model can't start
against a newer applied model.
Compatible and incompatible changes
During a deployment the previous release keeps running next to the new one, see
deployments, and keeps writing. Whether it can keep writing an entity type after vox migrate
applied the new model depends on the change:
- Compatible: the change only adds to what a document can hold, or makes a property filterable, sortable or
searchable. That's an added property at the top level, in a nested object, in the objects of a collection or
dictionary or in a field set, also a relation, a varying, computed or calculated property, a unique property whose
constraint has only added properties, and a
requiredproperty whose value aFillPropertystep gives, with nothing else about the entity type changing. The previous release keeps writing the type, and reads what the new release wrote, skipping the properties and field-set fields it doesn't know. - Incompatible: every other change that raises the model revision, eg a rename, a conversion, a transform, a removal,
a wider number or an enum with more members (which the previous release can't read), a change of kinds or of the
storage layout, an added relation that varies by contexts, and a unique constraint that combines an added property
with an existing one. From
vox migrateon, the previous release's writes of the type are refused with a retryable 503, and it can't read the documents the new release wrote.
The new release repairs what the previous one writes. The previous release doesn't maintain the storage of what it
doesn't know: the links of a new relation, the entities embedded in new rich text, the values of a new unique property,
the query storage of a new filterable, sortable or computed property, and the context memberships that new values
decide. So from vox migrate on, each save and delete of the previous release records the entities it wrote, in the
same transaction, and one of the new release's hosts repairs that storage from the stored entity in the background, next
to the migration steps and also while the new deployment is on standby. The memberships are recalculated once the new
deployment is active, since the previous release's processing would recalculate them without the new values. For example,
the new release adds Product.fabric, and an editor links a bag to Linen on it. Another editor fixes the bag's name on
the previous release, which drops the fabric. The new release then removes the bag's link to Linen, so filtering by
Linen no longer finds the bag and Linen doesn't list it. The repair also rewrites the documents that the previous release
wrote in its own revision, so they don't need the migration's fills any more.
vox migrate --plan says for each entity type whether its change is compatible with the previous release. Deploy a
release with an incompatible change to an entity type that its public flows write, eg the cart of a shop, with a
maintenance window; otherwise the customers still on the previous release can't save their carts until the traffic
moved.
What the previous release's writes do to new values. The previous release writes a document whole, from its own class, so a write from it to an entity that the new release gave a value of a new property drops that value:
- The previous release's processing doesn't: it leaves an entity whose document a newer model wrote to the new deployment, which processes it once it's active, with the new value intact. So when the new release takes traffic before it's activated, eg behind a load balancer that moves traffic gradually, a customer's gift message isn't lost when the previous release calculates the cart's totals.
- The previous release's jobs and imports run until the activation, and can drop a new value that a customer just wrote on the new release, eg an ERP import of order statuses. Use the activate-then-swap order, in which the new release gets no real traffic before it's active, or a maintenance window, when integrations write such a type during a deployment.
- A save on the previous release evaluates the saved entity's calculations with the previous release's code. After a
compatible change that adds a calculated property, eg the new release adds
Cart.estimatedDelivery, a cart saved through the previous release is published without it, and nothing calculates it again until another change of the cart reaches the new release's processing: it doesn't heal by itself. A team that needs the new value on every cart deploys with downtime, or recalculates the type after the deployment, eg with a migration'sRecalculate. The same holds for a calculation whose tracked query filters or sorts by a field no tracked query used before: the previous release's saves don't capture that field, so they don't reach the query, see Calculations. - A new query field, unique property or relation is built by the new release, and the repair keeps it right after the previous release's writes, see above. Until a written entity is repaired, usually moments after the write, a filter on the new release can still find its dropped value. On Redis, which keeps transient entity types, nothing is repaired: an index entry that a write of the previous release leaves stays until the entity is written again or expires.
- A new template of a field set is unknown to the previous release. Once an editor moves a product to it on the new release, the previous release refuses every save of that product with a validation error, eg a price import. Add templates in a release that the previous release's writers don't need during the deployment, or deploy with a maintenance window.
Forward only
There are no down migrations. Deploying an earlier model after a migration is rejected; undoing a change is a new forward migration. Conversions, removals and history rewrites can replace values irreversibly, so use database backups when the original values must be recoverable.
A migration class with conversions, fills or transforms is needed until its migration is complete in every installation, including those that skip releases, since old documents are converted when they're read. Startup fails if an installation still needs a class that isn't registered. The migration of a transient entity type is complete at once, so keep its class as long as documents written before it can exist, see Transient entity types. Completed declarative steps, eg renames, stay in the applied model's history.
Field sets
The fields of a field set are properties in code too, and they go through the same engine as nested
properties of the field-values property, eg specifications.sleepingPlaces: a field renamed with [VoxRenamedFrom] keeps
its stored values, a changed type is widened or converted like that of a property, and a removed field is declared like a
removed property.
Moving a field to another template or group doesn't change its path. Adding a field is
compatible with the previous release: it skips the fields it doesn't know in
what the new release stored, while an import or API write that names a field the set doesn't have is still refused.
Adding a template isn't, for the products that are moved to it during the deployment, see
Compatible and incompatible changes.
Synchronized applications
A contract manifest carries the names an entity type and its properties had before (renamedFrom) and its default kind.
A consumer that refreshes its generated classes gets [VoxRenamedFrom] from them, so its own model keeps its stored
data. A producer's CLR rename of a property with a pinned canonical name isn't a change of the contract: its revision
stays the same, and consumers generated before and after it receive the same snapshots, see
Canonical names and CLR names. Synchronization keeps delivering across contract revisions; coordinating a breaking change is the owners' rollout.
See Updating a contract.