Per-model behaviour

Versioning, publishing and variants are three switches on each model, and all of them start off. You turn on the ones a model's records need.

Three flags on each model

Each model carries three boolean flags: versioning, publishing and variants. You set them in the console when you create or edit a model, or as config as code, in foir.config.ts under the model's config. The console turns on the prerequisites for you, so publishing brings versioning with it and variants brings both.

A model with none of them

With all three off, records are read and written directly. An update replaces the data in place and takes effect at once. That suits form submissions, bookings, application configuration, feature flags and counters.

What each flag adds

Any one of the three makes the model versioned. Each save then writes a version, which gives the model its version history and a revert mutation. Publishing or variants also adds the publish, unpublish and schedule mutations behind drafts and scheduled publishing. The public models query reports what is switched on for each model in its capabilities field.

Changing a flag later

Turning a flag on migrates the model's existing records. Turning the last of the three off on a model that already holds records is refused. A flag change is part of the model's draft and reaches production in a release, where turning one off is flagged as breaking and turning one on is flagged for review.

Read the detail

The models guide describes each capability flag, what it requires and what happens to existing records when it changes.