pub const FORMAT_VERSION_V4: u16 = 4;Expand description
On-disk format revision. Bump when the page layout changes incompatibly.
History:
- Version 1 (Phases 2 / 3a / 3b): schema catalog and table data were opaque bincode blobs chained across typed payload pages.
- Version 2 (Phases 3c / 3d): tables are stored as cell-based B-Trees;
the schema catalog is itself a table called
sqlrite_masterwith four columns(name, sql, rootpage, last_rowid). - Version 3 (Phase 3e):
sqlrite_mastergains atypecolumn (first), distinguishing'table'and'index'rows; secondary indexes persist as their own cell-based B-Trees whose cells use the newKIND_INDEXformat. - Version 4 (Phase 7): cell encoding gains the
KIND_VECTORvalue tag (length-prefixed dense f32 array) for the newVECTOR(N)column type, plus theKIND_HNSWcell tag for vector ANN indexes. All Phase 7 storage additions (VECTOR cells, JSON cells, HNSW index nodes) live inside the v4 envelope. - Version 5 (Phase 8c): adds the
KIND_FTS_POSTINGcell tag for persisted FTS posting lists. Bumped on demand — a database without any FTS index keeps writing v4. The first save with at least one FTS index attached writes v5 instead. Decoders accept both v4 and v5; v5 reading a v4-shaped DB just sees zero FTS indexes insqlrite_master. See [Phase 8 plan Q10]. - Version 6 (SQLR-6): adds a persisted free-page list at header
bytes [28..32] (
freelist_head) plus thePAGE_TYPE_FREELIST_TRUNKpage tag. Bumped on demand — a save that produces no freed pages keeps writing the file’s existing version. The first save that yields a non-empty freelist promotes the file to v6.