Skip to content

feat(db): Option B schema — ContentCurrent + ContentHistory (Workstream D, draft) - #2021

Merged
jung-thomas merged 2 commits into
DEVfrom
feat/content-delta-publish-schema
Aug 25, 2026
Merged

feat(db): Option B schema — ContentCurrent + ContentHistory (Workstream D, draft)#2021
jung-thomas merged 2 commits into
DEVfrom
feat/content-delta-publish-schema

Conversation

@jung-thomas

Copy link
Copy Markdown
Contributor

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-only ContentHistory (per (version, slug), carries the BLOB for self-contained rollback replay). Aspects in db/_content-shape.cds; entities in both db/schema.cds and db-qa/schema.cds (QA parity).

Verified: full model compiles + deploys to sqlite::memory: cleanly.

NOT in this PR (the version-counter-hazard gate)

.hdbmigrationtable staging for the two new HANA tables. Local cds build --production writes to gen/ (build.target=gen) and does not reproduce the tracked db/src/ + db/last-dev/ diffs that CI's cds-build-staging-check expects — 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.

…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).
@jung-thomas
jung-thomas marked this pull request as ready for review August 25, 2026 10:30
@jung-thomas
jung-thomas merged commit 322f5f2 into DEV Aug 25, 2026
5 of 6 checks passed
@jung-thomas
jung-thomas deleted the feat/content-delta-publish-schema branch August 25, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant