pub fn run_object_schema(conn: &Connection) -> Result<(), StoreError>Expand description
Initialize (or re-validate) the full objects.db schema.
Idempotent — safe on every srv startup. Steps:
adopt_legacy_table_names— renames any pre-flatten forge/bundle tables found (protects dev databases created before the flatten; see the spec §3/§7) and drops the dead workflow/sentinel tables.- The flat
CREATE TABLE IF NOT EXISTSbatch — the canonical schema. - Seeds the blank Identity / Memory singleton rows.
A database stuck at a pre-v11 intermediate schema cannot be fully
adopted (its tables predate later columns). The adopt step still
renames what it finds; the first query referencing a missing column
then fails loudly with no such column — a hard error, not silent
empty state, with the data preserved on disk. Per-version data dirs
make that case unreachable for released builds.