Skip to content

refactor(schema): stop auto-fencing new tables in desired-state bootstrap - #8535

Open
ngoodger-block wants to merge 2 commits into
block:mainfrom
ngoodger-block:ngoodger/explicit-schema-fences
Open

ngoodger-block wants to merge 2 commits into
block:mainfrom
ngoodger-block:ngoodger/explicit-schema-fences

Conversation

@ngoodger-block

@ngoodger-block ngoodger-block commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Why?

This is a cleanup that brings the schema bootstrap in line with how the codebase works today, as asked for by docs/database.md (#8273). Writes are now blocked during community deletion by application admission (begin_community_write_transaction), and that doc's Rule 1 says new tables must not add triggers. But schema/community_write_fence.sql still looped over every table with a community_id column and attached the old fence trigger to it. That meant a new table got a trigger on a fresh database and none on a migrated one, so the two schema paths disagreed and new tenant tables were blocked. The doc says this bootstrap change must land "before the feature, or as the feature's first PR."

What?

Deletes the blanket fence loop and its \i from schema/schema.sql. Existing legacy tables keep their fences through their explicit schema/triggers/ files, so no current table loses its fence and runtime behavior is unchanged. Adds a test that a new community_id table stays unfenced while events and users stay fenced, and updates docs/database.md and ARCHITECTURE.md to match. It stands on its own; the media-sharing PRs (#8451, #8444) are the first to rely on it.

buzz-review-completed

Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
Signed-off-by: Nikolaj Goodger <ngoodger@squareup.com>
@ngoodger-block ngoodger-block changed the title Keep schema fence bootstrap explicit refactor(schema): stop auto-fencing new tables in desired-state bootstrap Oct 23, 2026
@ngoodger-block
ngoodger-block marked this pull request as ready for review October 23, 2026 04:30
@ngoodger-block
ngoodger-block requested a review from a team as a code owner October 23, 2026 04:30

This branch had an error being deployed

1 failed deployment
codex-review — 7892f0bd Deployed Oct 23, 2026 by ngoodger-block via Run Codex Security Review #9602
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