feat(db): Option B schema — ContentCurrent + ContentHistory (Workstream D, draft) - #2021
Merged
Conversation
…n B schema, Workstream D) Mutable current-content table (one row per slug, no version column) + append-only per-(version,slug) history carrying the BLOB for self-contained rollback replay (design.md D1/D2). Mirrored into the QA namespace. Verified: full model compiles + deploys to sqlite::memory:. NEXT (gated, not in this commit): .hdbmigrationtable staging for the two new HANA tables (db/src/ + db/last-dev/ regen via the project's cds-build-staging procedure) + hybrid deploy verify — the version-counter-hazard step. Then write path (dual-write, flag), readers, rollback.
… (Workstream D, flag-gated) commitSession now mirrors freshly-published slugs into the mutable ContentCurrent (UPSERT, one row per slug) + append-only ContentHistory (WRITTEN rows) when CONTENT_DELTA_WRITE_ENABLED=true, alongside the legacy ContentFiles write. Chunked BLOB read mirrors carryForwardUnchanged (raw db.run on HANA for the LOB-locator path, CQL on SQLite). Fail-SAFE: never throws into the commit tx — legacy ContentFiles stays the source of truth until the reader cutover. Tests (SQLite): test/unit/content-delta-dualwrite.test.js (4) — one-row-per-slug, UPSERT on republish, history append per version, flag-off writes neither. Existing commit-path tests still green (carryforward-memory + guard, 12). HANA LOB path is covered by the hybrid publish→rollback test (task 7.4).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What (draft — schema foundation of Workstream D / #2017)
Adds the Option B data model: a mutable
ContentCurrent(one row per slug, no version column — readers hit it directly) + append-onlyContentHistory(per (version, slug), carries the BLOB for self-contained rollback replay). Aspects indb/_content-shape.cds; entities in bothdb/schema.cdsanddb-qa/schema.cds(QA parity).Verified: full model compiles + deploys to
sqlite::memory:cleanly.NOT in this PR (the version-counter-hazard gate)
.hdbmigrationtablestaging for the two new HANA tables. Localcds build --productionwrites togen/(build.target=gen) and does not reproduce the trackeddb/src/+db/last-dev/diffs that CI'scds-build-staging-checkexpects — and mis-staging migration tables is the flagged "poisons the version counter" hazard. This needs the project's exact staging procedure + a hybrid deploy verify (cf login) before it's trustworthy. CI staging check will fail on this PR until that lands — expected for the draft.Then (subsequent PRs, per #2017 tasks 5–8)
Write path (dual-write behind a flag → deletes
carryForwardUnchanged), ~20 reader migrations (behind a read flag), rollback replay + drift + GC, cutover. Each with hybrid HANA verification (publish→rollback byte-identical).Design/tasks: #2017.