Constant SCHEMA_VERSION
pub const SCHEMA_VERSION: u32 = 2;projection-store only.Expand description
The highest projection schema version this build knows how to operate.
Persisted in projection_meta so that a later migration has something to
test against: a schema with no version marker cannot be migrated later
without guessing. It is this schema’s own marker, on its own terms — the
event store’s lives in store_meta and moves on a different story’s schedule.
§What the marker in a file means
The oldest build that may operate the file, which is not always the newest
schema this build writes. Version 2 added projection_protection, and a file
is written at 1 and stays there until something is protected: the table is
created on every open and is inert to a build that predates it, so a file
nothing has protected stays open to that build. The first
protect_from_reset raises the
marker to 2, in the same transaction as the mark, and from then on an older
build refuses the file with
UnsupportedSchemaVersion
rather than reset a protected projection without knowing.
The alternative that lost marked every file 2 on its first open by this build, which would have stopped an older build reading files that held nothing it could mishandle.